5

I'm new to and I'm trying to connect to a 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?

1 Answers1

3

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){}
);
DAiMor
  • 3,185
  • 16
  • 24
  • Found this doc: http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=BXJS_intro Pointed me to a downloads page... working on it. –  Aug 04 '16 at 21:33
  • 1
    cache0100.node and cache0120.node you may find in instance's bin directory, which you should rename to cache.nod. Where 0100 and 0120 means node's version 0.10 and 0.12 – DAiMor Aug 05 '16 at 05:37
  • Umm, `node -v` `v4.4.7` –  Aug 05 '16 at 15:58
  • I guess I'll just go back to VBScript and SQL –  Aug 05 '16 at 18:16