Published on InterSystems Developer Community (https://community.intersystems.com)

Home > Node.js using SQL query

Question
Cliff Akers · May 9, 2019

Node.js using SQL query

I am attempting to use Node.js to perform a simple query against the database using some identifying information to get the ID. This is what I am attempting to do:

 

var irisobj = require('iris');
var myData = new irisobj.IRIS();
var result = myData.open({ path:"C:/InterSystems/IRIS/Mgr",
                       username: "USERNAME",
                       password: "PASSWORD",
                       namespace: "YOURNAMESPACE"
            }
        );

var result = myData.invoke_classmethod({class: "%SYSTEM.SQL", method: "Execute", arguments: ["SELECT TOP 1 ID FROM SOMETABLE"]});
console.log(result);

myData.close();

Why doesn't this work???

#InterSystems IRIS

Source URL:https://community.intersystems.com/post/nodejs-using-sql-query