tediousjs / node-mssql

Microsoft SQL Server client for Node.js
https://tediousjs.github.io/node-mssql
MIT License
2.23k stars 468 forks source link

Could not connect (sequence) #1404

Closed narayanchoudhary closed 2 years ago

narayanchoudhary commented 2 years ago
ConnectionError: Failed to connect to 192.168.0.103:1433 - Could not connect (sequence)
    at G:\express\node_modules\mssql\lib\tedious\connection-pool.js:70:17
    at Connection.onConnect (G:\express\node_modules\tedious\lib\connection.js:1051:9)
    at Object.onceWrapper (node:events:642:26)
    at Connection.emit (node:events:527:28)
    at Connection.emit (G:\express\node_modules\tedious\lib\connection.js:1079:18)
    at Connection.socketError (G:\express\node_modules\tedious\lib\connection.js:1425:12)
    at G:\express\node_modules\tedious\lib\connection.js:1185:21
    at SequentialConnectionStrategy.connect (G:\express\node_modules\tedious\lib\connector.js:129:14)
    at Socket.onError (G:\express\node_modules\tedious\lib\connector.js:149:12)
    at Socket.emit (node:events:527:28) {
  code: 'ESOCKET',
  originalError: ConnectionError: Failed to connect to 192.168.0.103:1433 - Could not connect (sequence)
      at Connection.socketError (G:\express\node_modules\tedious\lib\connection.js:1425:28)
      at G:\express\node_modules\tedious\lib\connection.js:1185:21
      at SequentialConnectionStrategy.connect (G:\express\node_modules\tedious\lib\connector.js:129:14)
      at Socket.onError (G:\express\node_modules\tedious\lib\connector.js:149:12)
      at Socket.emit (node:events:527:28)
      at emitErrorNT (node:internal/streams/destroy:157:8)
      at emitErrorCloseNT (node:internal/streams/destroy:122:3)
      at processTicksAndRejections (node:internal/process/task_queues:83:21) {
    code: 'ESOCKET',
    isTransient: undefined
  }
}

My Code//////////////

app.get('/', (req, res) => {

  const sql = require('mssql')
  const sqlConfig = {
    user: 'sa',
    password: 'sa',
    database: 'MANDISOFT',
    server: '192.168.0.103',
    port: 1433,
    pool: {
      max: 10,
      min: 0,
      idleTimeoutMillis: 30000
    },
    options: {

      encrypt: true, // for azure
      trustServerCertificate: true// change to true for local dev / self-signed certs
    }
  }

  const name = async () => {
    try {
      await sql.connect(sqlConfig)
      const result = await sql.query`select * from firms`
      console.log(result)
    } catch (err) {
      console.log(err);
    }
  }

  name();
  console.log('sent')
  res.send('Hello World!')
})

Software versions

dhensby commented 2 years ago

I'm not sure what the bug report / issue is here. You've just provided and error and some generic code but no further details.

The error indicates a connection could not be made to your SQL Server, that seems fair enough.