Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issues with output while connecting using nodejs mssql

I'm new to node.js and I'm trying to connect to a intersystems-cache database. Here is what I have, based off the sample code in the docs:

var sql = require('mssql');

console.log("Connecting...");

sql.connect("mssql://username:password@server:1234/DB").then(function(){
    console.log("connected");
}).catch(function(err) {
    console.log(err)
});

If I put in the wrong server or port, I get a Failed to connect error, but no matter what else I enter incorrectly (username, pass, db) I get zero output. More importantly, when all the data is correct I never get the connected output.

Is this a compatibility issue with Cache and the mssql library? Or am I doing something wrong?

like image 931
THE JOATMON Avatar asked Oct 19 '22 04:10

THE JOATMON


1 Answers

why do you use mssql, instead of cache, while you have to connect to cache. If you look at the documentation, you may find and example

var globals = require('cache');
var mydata = new globals.Cache();
mydata.open(
  { path:"/cache20102/mgr",
    username: "_SYSTEM",
    password: "SYS",
    namespace: "USER"
  },
  function(error, result){}
);
like image 176
DAiMor Avatar answered Nov 02 '22 05:11

DAiMor