Reputation: 31
I have a question about sequelize and sql server.
So I can connect to my database with "localhost" or name of my computer, but i cant to "(LocalDB)\MSSQLLocalDB". This is my connection parameter.
PASSWORD: "sw",
DB: "BusinessDB",
CONFIG: {
host: '(LocalDB)\\MSSQLLocalDB',
dialect: 'mssql',
dialectOptions: {
options: {
encrypt: true,
}
},
pool: {
max: 5,
min: 0,
acquire: 30000,
idle: 10000
},
define:{
timestamps: false,
}
}
```
And this is the error when i'm trying to connect with this config
> Failed to connect to (LocalDB)\MSSQLLocalDB:1433 - getaddrinfo ENOTFOUND (LocalDB)\MSSQLLocalDB
Someone have the solutions for that. I search on google but I doesn't find a solution.
Thanx
Upvotes: 1
Views: 1032
Reputation: 31
I found a solution with the help of "msnodesqlv8" module.
Now i'm using this configuration for connect to my DB.
dialect: 'mssql',
dialectModule: require('msnodesqlv8/lib/sequelize'),
bindParam: false,
/*logging: false,*/
dialectOptions: {
options: {
connectionString: 'Driver={ODBC Driver 17 for SQL Server};Server= (LocalDB)\\MSSQLLocalDB;Database=MyDB;Trusted_Connection=yes;',
},
},
define:{
timestamps: false,
}
The driver version can be found on ODBC data sources software.(type in windows search bar)
Upvotes: 2