Search code examples
sql-servernode.jsibm-cloud

Node.js: MSSQL module : IBM Bluemix: connection error


I am running an application over IBM Bluemix and my backend database is SQL Server hosted on a remote server. I can easily connect with the SQL Server database using GUI tool, but when I try to connect and execute a query using the sql.js file, I am getting following error:

Query to execute:

SELECT * 
FROM SUBSCRIBER 
WHERE SUBSCRIBER_ID = 'abc'

Error:

ConnectionError: Login failed for user 'admin'.

My connection string:

msdb.connect("mssql://admin:root@[ip in actual code]/watch-me").then(function() {
.catch(function(err) {
        // ... query error checks 

        callBack(1,err,null,responseObj);
    });
}).catch(function(err) {
    console.log("error: " + err);
    // ... connect error checks 
    callBack(1, err, null, responseObj);

Solution

  • In my connection String, database name was not correct, fixed it and it's working now.