Hi, I'm getting the following error when trying to run the above code in
node.js
SEV DATE TIME FROM PGM LIBRARY INST TO PGM
LIBRARY
00 10-02-17 23:40:46,758703 QSQROUTS QSYS *STMT QSQCLI
QSYS
From module . . . . . . . . : QSQSRVRC
From procedure . . . . . . : SQSERVER
Statement . . . . . . . . . : 8224
To module . . . . . . . . . : SQLCON
To procedure . . . . . . . : SQLConnect
Statement . . . . . . . . . : 13395
Message . . . . : Job 005884/QUSER/QSQSRVR used for SQL server mode
processing.
Årsag . . . . . : A Structured Query Language (SQL) statement was
executed
while running in SQL server mode. SQL statements for this connection
or
thread will be processed in job 005884/QUSER/QSQSRVR. Teknisk
beskrivelse .
. . . . . . . : SQL server mode was requested by either setting the
SQL
server mode job attribute, or by setting the server mode environment
attribute via the SQL Call Level Interface. When running in this mode,
SQL
statements are processed by a separate job, which runs under the user
profile specified for the connection. The thread identifier is 2 and the
connection is to Relational Database C602082A. If the Relational
Database
name is *N, this means that all connections for the thread will use the
same
job.
The node.js server i started by a submittet job and tries to run this code:
// Input from DB2
var db = require('/QOpenSys/QIBM/ProdData/OPS/Node6/os400/db2i/lib/db2a');
var sql = "SELECT STATE,LSTNAM FROM QIWS.QCUSTCDT";
var dbconn = new db.dbconn(); // Create a connection object.
dbconn.conn("*LOCAL"); // Connect to a database.
var stmt = new db.dbstmt(dbconn); // Create a statement object of the
connection.
stmt.exec(sql, function(result) {
console.log("Result: %s", JSON.stringify(result));
var fieldNum = stmt.numFields();
console.log("There are %d fields in each row.", fieldNum);
console.log("Name | Length | Type | Precise | Scale | Null");
for(var i = 0; i < fieldNum; i++) {
console.log("%s | %d | %d | %d | %d | %d", stmt.fieldName(i),
stmt.fieldWidth(i), stmt.fieldType(i), stmt.fieldPrecise(i),
stmt.fieldScale(i), stmt.fieldNullable(i));
};
delete stmt; // Clean up the statement object.
dbconn.disconn(); // Disconnect from the database.
delete dbconn; // Clean up the connection object.
});
Any guess?
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.