question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot Connect To Named Instance

See original GitHub issue

I’ve been trying to connect to a local sql server instance for quite some time now with no luck. The error I’m getting is

Connection Error: ConnectionError: Port for sqlserver not found in ServerName;DSHOOK-BCPC;InstanceName;MSSQLSERVER;IsClustered;No;Version;10.50.4000.0;;ServerName;DSHOOK-BCPC;InstanceName;SQLSERVER;IsClustered;No;Version;10.50.4000.0;

Where my config looks like

var config_local = {
  user: 'test',
  password: 'test',
  server: 'localhost\\sqlserver',
  database: 'ReloDotNet2',
  //port: 1433,
  //stream: true,
  options: {
    // localAddress: 'localhost',
    // instanceName: 'sqlserver'
  }
};

I’m using the newest version of node-mssql and tedious:

"tedious": "^1.10.0",
"mssql": "^2.1.x",

And made sure the SQL Server Agent/Browser services are running on my machine. I’ve tried all the combinations of the config that I can think of with the commented out options and the server property including the instance name.

I’ve spent a fair amount of time with the debugger trying to figure this out too. It seems like the root error is in tedius line 343:

 create: (function(_this) {
            return function(callback) {
              var c;
              c = new tds.Connection(cfg);
              c.once('connect', function(err) {
                if (err) { // <- right here
                  err = ConnectionError(err);
                }
                if (err) {
                  return callback(err, null);
                }

Where the err is

"EINSTLOOKUP": "Port for sqlserver not found in ServerName;DSHOOK-BCPC;InstanceName;MSSQLSERVER;IsClustered;No;Version;10.50.4000.0;;ServerName;DSHOOK-BCPC;InstanceName;SQLSERVER;IsClustered;No;Version;10.50.4000.0;;"

Any ideas on what’s going wrong? I can connect fine with management studio and SqlDBX.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:8

github_iconTop GitHub Comments

9reactions
dshookcommented, Feb 23, 2015

Wow yep, that was it. For future reference, the setting is in Sql Server Configuration Manager > SQL Server Network Configuration > Protocols for SQLSERVER > TCP/IP

5reactions
patriksimekcommented, Feb 23, 2015

This error originates here in Tedious. The problem is SQL Server Browser doesn’t respond with server’s port. Is TCP enabled on your SQL Server?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't connect using named instance from 1 client
1) Make sure your server name is correct, e.g., no typo on the name. ... 3) Make sure the server machine is reachable,...
Read more >
Cannot connect remotely to a SQL Server named instance
You need to start the SQL Server Browser service on the VM that hosts the SQL Server instances. You can find this by...
Read more >
Resolving could not open a connection to SQL Server errors
Check to see if allow remote connections for this server is enabled. In SSMS, right click on the instance name and select Properties....
Read more >
Unable to connect to named instance. - SQLServerCentral
Issue :- I am able to connect to the named instance from within the server but not from outside. Additional info :- Remote...
Read more >
Connecting an MS-SQL named instance | Looker
How MS-SQL named instances connect · Your client contacts the host, named on the default MS-SQL port (1433). · MS-SQL responds with the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found