See the QueryResult part of the program:
/** This example demonstrates-to-fetch a single row from a large table* One by one and get processed by application. It avoids allocation of* Large memory by the ibm_db and data processing becomes easier. ** This example have used Sync methods, but async methods also exist. */var Ibmdb = require (".. /")//require ("ibm_db"), conn =NewIbmdb. Database (), CN ="Database=sample;hostname=hotel.torolab.ibm.com;port=21169;uid=newton;pwd=xxxx";//OpenA connection to the DatabaseConn.opensync (CN);//Create Table and Insert some rows toIt.conn.querySync ("CREATE TABLE Mytab (c1 int, c2 varchar)"); Conn.querysync ("INSERT into mytab values (1, ' Bimal '), (2, ' Kamal '), (3, ' Mohan '), (4, ' Ram ')");//Select Data from TableConn.queryresult ("SELECT * from Mytab",function(Err, result) {if(ERR) {Console.log (ERR);return; }//Fetch Single Row atOnce andProcess it. Note that QueryResult'll bring only64kData fromServer andResult.fetchsync//wouldreturn each Row fromThis 64k client buffer. Once All Data is Read fromBuffer, ibm_db driver'll bring another 64kChunk of Data fromServer. VarData; while(Data= Result.fetchsync ()) {Console.log (Data); } //Drop the Table and CloseConnection. Conn.querysync ("drop table Mytab"); Conn.closesync ();});
Reference Link: https://github.com/ibmdb/node-ibm_db/blob/master/examples/singleRowFetch.js
node. JS connection DB2 Implementation fetchrows line to get SQL source code