gpt4 book ai didi

node.js - 连接到 (LocalDB)\MSSQLLocalDB Sequelize

转载 作者:行者123 更新时间:2023-12-03 22:33:37 28 4
gpt4 key购买 nike

我有一个关于 sequelize 和 sql server 的问题。
所以我可以使用“localhost”或我的计算机名称连接到我的数据库,但我不能连接到“(LocalDB)\MSSQLLocalDB”。这是我的连接参数。

  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


最佳答案

我在“msnodesqlv8”模块的帮助下找到了一个解决方案。
现在我正在使用此配置连接到我的数据库。

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,
}
驱动版本可以在ODBC数据源软件中找到。(在windows搜索栏输入)

关于node.js - 连接到 (LocalDB)\MSSQLLocalDB Sequelize,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64152768/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com