1

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


1 Answer 1

2

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)

1
  • Work also for me :D Commented Sep 11, 2022 at 0:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.