无法使用SequelizeJS连接到本地SQL Server

时间:2019-05-29 02:27:23

标签: node.js sql-server express sequelize.js

我正在尝试连接到本地SQL Server,但显示错误SequelizeHostNotFoundError。我可以在SSMS上连接它。

instance = new Sequelize('database', 'local123', 'local123', {
   host: "tcp:NETWORK-PC\\MYCOMPANYSQL,49172",
   dialect: 'mssql',
   port: 49172,
   operatorsAliases: false,
   dialectOptions: {
      options: {
          encrypt: true,
      }
   },
   pool: {
      max: 5,
      min: 0,
      acquire: 30000,
      idle: 10000
   },
})
  

错误:SequelizeHostNotFoundError:无法连接到tcp:NETWORK-PC \ MYCOMPANYSQL,49172-getaddrinfo ENOTFOUND tcp:NETWORK-PC \ MYCOMPANYSQL,49172

1 个答案:

答案 0 :(得分:0)

本地处于什么级别?您是否尝试过将“ localhost”作为主机?