KVNA
KVNA

Reputation: 907

Which IP to Use to Remote Connect to SQL Server?

I am trying to remotely connect to a Microsoft SQL Server from Node (using node-mssql).

var sql = require('mssql')

var config = {
  server:   '**',
  user:     '**',
  password: '**!',
  database: '**'
}

sql.connect(config, function(err) {
  var request = new sql.Request()
  request.query("select *", function(err, recordset) {
    console.log(err)
    console.log(recordset)
  })
  console.log('end')
})

I ran the following query from the server:

SELECT  
   CONNECTIONPROPERTY('net_transport') AS net_transport,
   CONNECTIONPROPERTY('protocol_type') AS protocol_type,
   CONNECTIONPROPERTY('auth_scheme') AS auth_scheme,
   CONNECTIONPROPERTY('local_net_address') AS local_net_address,
   CONNECTIONPROPERTY('local_tcp_port') AS local_tcp_port,
   CONNECTIONPROPERTY('client_net_address') AS client_net_address 

based on SQL - Query to get server's IP address

Do I use the client_net_address to remote connect, or some other IP for the server parameter?

Upvotes: 0

Views: 1168

Answers (1)

KVNA
KVNA

Reputation: 907

If connecting from an application on the same machine, use the local_net_address.

Upvotes: 1

Related Questions