Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
222 views
Welcome To Ask or Share your Answers For Others

1 Answer

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...