Hi,
I am having problems creating a connection string that works.
Server version: SQL Server 2014 Express.
I can login to SQL Management Studio with the same credentials.
Server name: (local)\SQLEXPRESS2014
User: test
Pass: testtest
To login with nodejs i tried this:
var sql = require('mssql');
var config = {
connectionString: 'Server=(local)\\SQLEXPRESS2014;Database=test-server;UID=test;PWD=testtest;',
};
var connection = new sql.Connection(config);
connection.connect(function(err) {
console.log(err); // This is always getting hit
});
That however returns the following error:
{ [ConnectionError: Failed to connect to undefined:1433 - connect ECONNREFUSED 127.0.0.1:1433]
name: 'ConnectionError',
message: 'Failed to connect to undefined:1433 - connect ECONNREFUSED 127.0.0.1:1433',
code: 'ESOCKET' }
Same error if i change the config to:
var connection = new sql.Connection({
user: 'test',
password: 'testtest',
server: '(local)\\SQLEXPRESS2014', // or localhost\\SQLEXPRESS2014
database: 'test-server'
});
Somehow it does not translate the connection correctly.
(My file only contains the first lines at the top to connect. Otherwise it's completely empty. I wanted to get the connection to work before writing any other code.)
Hi,
I am having problems creating a connection string that works.
Server version: SQL Server 2014 Express.
I can login to SQL Management Studio with the same credentials.
Server name: (local)\SQLEXPRESS2014
User: test
Pass: testtest
To login with nodejs i tried this:
That however returns the following error:
{ [ConnectionError: Failed to connect to undefined:1433 - connect ECONNREFUSED 127.0.0.1:1433]
name: 'ConnectionError',
message: 'Failed to connect to undefined:1433 - connect ECONNREFUSED 127.0.0.1:1433',
code: 'ESOCKET' }
Same error if i change the config to:
Somehow it does not translate the connection correctly.
(My file only contains the first lines at the top to connect. Otherwise it's completely empty. I wanted to get the connection to work before writing any other code.)