Tedious Connection test

142 views
Skip to first unread message

Santo haryono weli

unread,
Apr 4, 2018, 1:59:17 PM4/4/18
to tedious
I have a problem like this when testing connection in tedious

Message:
     Expected { message : 'Failed to connect to .\SQLEXPRESS:1433 - getaddrinfo ENOTFOUND .\SQLEXPRESS', code : 'ESOCKET' } to be null.
   Stacktrace:
     Error: Expected { message : 'Failed to connect to .\SQLEXPRESS:1433 - getaddrinfo ENOTFOUND .\SQLEXPRESS', code : 'ESOCKET' } to be null.
    at Connection.<anonymous> (D:\SelfLearning\NodeJSTraining\MVCNodeJSExample\tests\mssql.spec.js:14:25)
    at emitOne (events.js:116:13)
    at Connection.emit (events.js:211:7)
    at Connection.socketError (D:\SelfLearning\NodeJSTraining\MVCNodeJSExample\node_modules\tedious\lib\connection.js:875:14)
    at D:\SelfLearning\NodeJSTraining\MVCNodeJSExample\node_modules\tedious\lib\connection.js:740:25
    at GetAddrInfoReqWrap.callback (D:\SelfLearning\NodeJSTraining\MVCNodeJSExample\node_modules\tedious\lib\connector.js:68:18)
    at GetAddrInfoReqWrap.onlookupall [as oncomplete] (dns.js:104:17)

and my test code like below

describe("MSSQL", function() {
it("is there a server running", function(next) {
var MSSQLClient = require('tedious').Connection
var config = {
userName: 'sa',
password: '*********',
server: '.\\SQLEXPRESS',
options: {
database: 'BootcampDB'
}
}
var connection = new MSSQLClient(config)
connection.on('connect', function(err) {
expect(err).toBe(null)
next()
})
})
 

Tito

unread,
Nov 13, 2018, 8:46:30 PM11/13/18
to tedious
is that really the name of your sql server instance? SQLEXPRESS?
try using (localhost)

are you running this on a windows machine?
Reply all
Reply to author
Forward
0 new messages