Jemin Jose
Jemin Jose

Reputation: 453

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:

       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. But after i hosted it in Azure Cloud i keep running in to this error

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.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) 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' }

SQL Server is using default port and TCP/IP is enabled.

Upvotes: 1

Views: 704

Answers (1)

Tom Sun
Tom Sun

Reputation: 24549

According to error information, it indicates that it can't connect to your SQL server. I assume that you are using local SQL server.

If it is that case, webapp can't connect the local SQL server by default. You could use Hybrid connections to make sure that you can connect to the local SQL server. I also recommand that you could use Azure SQL database to replace local SQL server.

Upvotes: 3

Related Questions