1

I am trying to connect to sql server from node.js like so -

const sql = require('mssql')

const pool = new sql.ConnectionPool({
  database: 'db',
  server: 'name',
  port: 41041,
  driver: 'msnodesqlv8',
  options: {
    trustedConnection: true,
    integratedSecurity: true
  }
})

pool.connect().then(() => {
  //simple query
  pool.request().query('select top 10 * from sync', (err, result) => {
        console.dir(result)
    })
})

But it is giving me this error - ConnectionError: Failed to connect to name:41041 in 15000ms at Connection.tedious.once.err

I am successfully able to connect via ssms like so name, 41041. Maybe it is unable to connect because it is using name: 41041. Any ideas on how to fix this?

3

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.