简体   繁体   English

ConnectionError:无法连接到 <SQLServerDB> -连接EACCES <SQLServerDB>

[英]ConnectionError: Failed to connect to <SQLServerDB> - connect EACCES <SQLServerDB>

I am trying to connect to a SQL server DB using the config from Azure Cloud: 我正在尝试使用Azure Cloud的配置连接到SQL Server数据库:

       var config = {
              user: UserName,
              password: Password,
              server: Server IP,
              dialect:'mssql',
              options: {database: DBName}
          };
    sql.connect(config, function (err) {
//Code
}

The Code is in node.js and it was running fine in my remote desktop. 该代码位于node.js中,并且在我的远程桌面上运行良好。 But after i hosted it in Azure Cloud i keep running in to this error 但是在将其托管在Azure云中之后,我继续遇到此错误

ConnectionError: Failed to connect to {SQLServerDB} - connect EACCES {SQLServerDB} at Connection.tedious.once.err (D:\\home\\site\\wwwroot\\node_modules\\mssql\\lib\\tedious.js:216:17) at Connection.g (events.js:291:16) at emitOne (events.js:96:13) at Connection.emit (events.js:188:7) at Connection.socketError (D:\\home\\site\\wwwroot\\node_modules\\tedious\\lib\\connection.js:1004:14) at D:\\home\\site\\wwwroot\\node_modules\\tedious\\lib\\connection.js:869:25 at Socket.onError (D:\\home\\site\\wwwroot\\node_modules\\tedious\\lib\\connector.js:49:9) at emitOne (events.js:96:13) at Socket.emit (events.js:188:7) at emitErrorNT (net.js:1276:8) code: 'ESOCKET', originalError: { ConnectionError: Failed to connect to {SQLServerDB} - connect EACCES {SQLServerDB} at ConnectionError (D:\\home\\site\\wwwroot\\node_modules\\tedious\\lib\\errors.js:12:12) at Connection.socketError (D:\\home\\site\\wwwroot\\node_modules\\tedious\\lib\\connection.js:1004:30) at D:\\home\\site\\wwwroot\\node_modules\\tedious\\lib\\connection.js:869:25 at Socket.on ConnectionError:无法连接到{SQLServerDB}-在Connection处通过Connection.tedious.once.err(D:\\ home \\ site \\ wwwroot \\ node_modules \\ mssql \\ lib \\ tedious.js:216:17)连接EACCES {SQLServerDB}。 g(events.js:291:16)在emitOne(events.js:96:13)在Connection.emit(events.js:188:7)在Connection.socketError(D:\\ home \\ site \\ wwwroot \\ node_modules \\ D:\\ home \\ site \\ wwwroot \\ node_modules \\ tedious \\ lib \\ connection.js:869:25在Socket.onError(D:\\ home \\ site \\ wwwroot \\ node_modules)中的乏味\\ lib \\ connection.js:1004:14) \\\\ tedious \\ lib \\ connector.js:49:9)在emissionOne(events.js:96:13)在Socket.emit(events.js:188:7)在emitErrorNT(net.js:1276:8)代码: 'ESOCKET',原始错误:{ConnectionError:无法连接到{SQLServerDB}-在ConnectionError处连接EACCES {SQLServerDB}(D:\\ home \\ site \\ wwwroot \\ node_modules \\ tedious \\ lib \\ errors.js:12:12) .socketError(D:\\ home \\ site \\ wwwroot \\ noderoot_modules \\ tedious \\ lib \\ connection.js:869:25处的D:\\ home \\ site \\ wwwroot \\ node_modules \\ tedious \\ lib \\ connection.js:1004:30) Socket.on Error (D:\\home\\site\\wwwroot\\node_modules\\tedious\\lib\\connector.js:49:9) at emitOne (events.js:96:13) at Socket.emit (events.js:188:7) at emitErrorNT (net.js:1276:8) at _combinedTickCallback (internal/process/next_tick.js:74:11) at process._tickDomainCallback (internal/process/next_tick.js:122:9) message: 'Failed to connect to {SQLServerDB}- connect EACCES {SQLServerDB}, code: 'ESOCKET' }, name: 'ConnectionError' } 在Socket.emit(events.js:188:7)的emitOne(events.js:96:13)发生错误(D:\\ home \\ site \\ wwwroot \\ node_modules \\ tedious \\ lib \\ connector.js:49:9)在process._tickDomainCallback(internal / process / next_tick.js:122:9)的_combinedTickCallback(internal / process / next_tick.js:74:11)处发出错误(NT.js:1276:8)消息:'无法连接到{ SQLServerDB}-连接EACCES {SQLServerDB},代码:'ESOCKET'},名称:'ConnectionError'}

SQL Server is using default port and TCP/IP is enabled. SQL Server使用默认端口,并且启用了TCP / IP。

According to error information, it indicates that it can't connect to your SQL server. 根据错误信息,表明它无法连接到您的SQL Server。 I assume that you are using local SQL server. 我假设您正在使用本地SQL Server。

If it is that case, webapp can't connect the local SQL server by default. 在这种情况下,默认情况下,webapp无法连接本地SQL服务器。 You could use Hybrid connections to make sure that you can connect to the local SQL server. 您可以使用混合连接来确保可以连接到本地SQL Server。 I also recommand that you could use Azure SQL database to replace local SQL server. 我还建议您可以使用Azure SQL数据库替换本地SQL Server。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ConnectionError:无法连接到MyServer:1433 - ConnectionError: Failed to connect to MyServer:1433 [连接错误:15000 毫秒内无法连接到 IP] - [ConnectionError: Failed to connect to IP in 15000ms] ConnectionError:无法连接到{数据库服务器}-无法连接(顺序) - ConnectionError: Failed to connect to {database server} - Could not connect (sequence) ConnectionError:无法连接到localhost:15000ms内未定义 - ConnectionError: Failed to connect to localhost:undefined in 15000ms ConnectionError [SequelizeConnectionError]:无法连接到:1433 - 无法连接(序列)本地机器 window 10 - ConnectionError [SequelizeConnectionError]: Failed to connect to :1433 - Could not connect (sequence) local machine window 10 Node.js MSSQL tedius ConnectionError: Failed to connect to localhost:1433 - connect ECONNREFUSED - Node.js MSSQL tedius ConnectionError: Failed to connect to localhost:1433 - connect ECONNREFUSED 使用 sequelize-automate 出现错误“ConnectionError [SequelizeConnectionError]:无法连接到 localhost:1443 - 无法连接(序列)” - Error "ConnectionError [SequelizeConnectionError]: Failed to connect to localhost:1443 - Could not connect (sequence)" using sequelize-automate 如何解决“ConnectionError:无法连接到<server> :<port> 在 15000 毫秒内”错误? - How do I fix the "ConnectionError: failed to connect to <server>:<port> in 15000ms" error? 连接主机MyServerName失败 - Failed to connect to host MyServerName SQLConnect() 连接服务器失败 - SQLConnect() failed to connect server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM