gpt4 book ai didi

electron - 通过ssh隧道(ngrok)连接到SQL Server

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

我正在制作一个 Electron JS应用程序,该应用程序使用msnodesqlv8连接到sql server 2000。使用本地主机一切正常,但我想使用隧道连接到它。我正在尝试使用ngrok。
这是我的连接字符串:

"Driver={SQL Server};Server={ngrok_tunnel_url};Database={DBname};Uid={sa};Pwd={root};Trusted_Connection={No};"

当我通过连接字符串将localhost传递给服务器时,它可以工作,但是当我使用端口(1433)传递给服务器时,它不起作用。
也许我做错了。任何人都可以指导一下。谢谢

最佳答案

您在问题上取得了进一步的进展吗?
看一下您发布的连接字符串:

"Driver={SQL Server};Server={ngrok_tunnel_url};Database={DBname};Uid={sa};Pwd={root};Trusted_Connection={No};"
并查看库源示例:
https://github.com/TimelordUK/node-sqlserver-v8/wiki#sequelize-compatibility
const Sequelize = require('sequelize')

let sequelize = new Sequelize({
dialect: 'mssql',
dialectModulePath: 'msnodesqlv8/lib/sequelize',
dialectOptions: {
'user': '',
'password': '',
'database': 'scratch',
'connectionString': 'Driver={SQL Server Native Client 11.0};Server= np:\\\\.\\pipe\\LOCALDB#2DD5ECA9\\tsql\\query;Database=scratch;Trusted_Connection=yes;',
'options': {
'driver': 'SQL Server Native Client 11.0',
'trustedConnection': true,
'instanceName': ''
}
},
pool: {
min: 0,
max: 5,
idle: 10000
}
})
我会尝试在您的连接字符串中测试更新: Trusted_Connection=noTrusted_Connection=yes然后看看会发生什么:-)

关于electron - 通过ssh隧道(ngrok)连接到SQL Server,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56849217/

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