use of db2a to connect to db2 database

Use this board to ask questions or have discussions with other Profound.js users.
derick_castillo
New User
Posts: 2
Joined: Thu Oct 19, 2017 1:17 pm
First Name: Derick
Last Name: Castillo
Company Name: Brunswick
Contact:

use of db2a to connect to db2 database

Post by derick_castillo »

this is my code:

var db = require('/QOpenSys/QIBM/ProdData/OPS/Node6/os400/db2i/lib/db2a');
pjs.defineDisplay("display", "dericktest3.json");
function derickTest3() {
var DBname = '*LOCAL';
var userId = '********';
var passwd = '**********';
var data1 = ['test0','test1','test2'];
var sql = "SELECT NAME, DESCRIPTION FROM OBMENHDS.SFBLDGP";

var dbconn = new db.dbconn();
var connect = pjs.fiber.wrap(dbconn.conn,dbconn);
connect (DBname, userId, passwd);
var stmt = new db.dbstmt(dbconn);
var sqlexec = pjs.fiber.wrap(stmt.exec,stmt);
while (!btnexit) {
var data2 = sqlexec(sql);
name = JSON.stringify(data2);

stmt.close();
dbconn.disconn();
dbconn.close();

display.screen1.execute();

}
}
exports.run = derickTest3;


It is giving me the following error: "This fiber is already running"
does anybody know how to fix this issue?

Who is online

Users browsing this forum: No registered users and 1 guest