参见程序中的queryResult那部分:

/*
* This example demonstrates how 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 has used Sync methods, but async methods also exist.
*/ var ibmdb = require("../") //require("ibm_db")
, conn = new ibmdb.Database()
, cn = "database=sample;hostname=hotel.torolab.ibm.com;port=21169;uid=newton;pwd=xxxx"
; // open a connection to the database
conn.openSync(cn); // create table and insert some rows to it.
conn.querySync("create table mytab (c1 int, c2 varchar(20))");
conn.querySync("insert into mytab values (1, 'bimal'),(2, 'kamal'),(3,'mohan'),(4,'ram')"); // Select data from table
conn.queryResult("select * from mytab", function (err, result) {
if(err) {
console.log(err);
return;
} // Fetch single row at once and process it.
// Note that queryResult will bring only 64k data from server and result.fetchSync
// will return each row from this 64k client buffer. Once all data is read from
// buffer, ibm_db driver will bring another 64k chunk of data from server.
var data;
while( data = result.fetchSync() )
{
console.log(data);
} // drop the table and close connection.
conn.querySync("drop table mytab");
conn.closeSync();
});

参考链接:https://github.com/ibmdb/node-ibm_db/blob/master/examples/singleRowFetch.js

node.js连接DB2实现fetchRows一行一行获取sql的源码的更多相关文章

  1. [第十八篇]——Docker 安装 Node.js之Spring Cloud大型企业分布式微服务云架构源码

    Docker 安装 Node.js Node.js 是一个基于 Chrome V8 引擎的 JavaScript 运行环境,是一个让 JavaScript 运行在服务端的开发平台. 1.查看可用的 N ...

  2. Node.js连接Mysql,并把连接集成进Express中间件中

    引言 在node.js连接mysql的过程,我们通常有两种连接方法,普通连接和连接池. 这两种方法较为常见,当我们使用express框架时还会选择使用中间express-myconnection,可以 ...

  3. Node.js 连接 MySQL 并进行数据库操作

    Node.js 连接 MySQL 并进行数据库操作  按照这篇操作mysql的指引,我远程操作了我另一台电脑的mysql数据库. var mysql = require('mysql'); var c ...

  4. Node.js连接MySQL数据库及构造JSON的正确姿势

    做一下整理,以前也很随意的引入包链接数据库,后来发现常常连接出问题,异常退出,后来使用在网上一个方法解决问题,网址由于书签丢失,抱歉不能引用了.再有就是简单的模块化下,使得目录合理点,再有就是说明一下 ...

  5. node.js连接MySQL操作及注意事项

    node.js作为服务端的js运行环境已经出现了有几年了,最近我有个朋友也在做这方面的开发,但是也是刚刚接触,遇到了很多坑.前几天他们在操作数据库的时候出现了点问题,后来我们一起看了看,其实都是nod ...

  6. Windows 7 下 Node.js 连接 Oracle

    原创作者: sailtseng 1. 安装 Oracle 11g express  详见: <Windows 7 x64 安装 Oracle 11g Express> 2. 安装 Micr ...

  7. MySQL+Node.js连接和操作

    在本节中,您将学习如何使用mysql模块从node.js应用程序与MySQL进行交互. 我们将向您展示如何使用Node.js连接到MySQL,执行常用操作,如使用mysql模块API执行插入,选择,更 ...

  8. windows下安装mongodb以及node.js连接mongodb

    一.MongoDB 下载 下载地址  https://www.mongodb.com/download-center#community  选择windows版下载,然后安装. 二.安装完毕后创建数据 ...

  9. node.js连接本地数据库及json返回数据

    新建一个文件夹node.js,目录下打开命令初始化一下 cnpm init 然后下载express框架 cnpm install express --save 接着下载数据库的依赖 cnpm inst ...

随机推荐

  1. H5--性能测试(PageSpeed Insights )

    中文网站(不需要翻墙): http://www.googlespeed.cn 主要可实现: 1.测试手机与电脑打开的速度对比. 2.详细的测试结果 3.直观的统计数据,查看页面的共xx个请求.总共大小 ...

  2. LeetCode 294. Flip Game II

    原题链接在这里:https://leetcode.com/problems/flip-game-ii/ 题目: You are playing the following Flip Game with ...

  3. MySQL数据库卸载有残留, windows10 sc delete 拒绝访问 失败5

    sc delete 拒绝访问,原因是当前用户的权限不足,需要做的是在注册表 HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\P ...

  4. bzoj 1396/2865: 识别子串 后缀自动机+线段树

    水水的字符串题 ~ #include <map> #include <cstdio> #include <cstring> #include <algorit ...

  5. learning svn add file execuable

    svn propset svn:executable on  <file> 为了给svn仓库里的问件添加可执行权限.

  6. 学生管理系统——数据库、java基础

    1.项目分层 view层:视图层 controller层:控制层 service层:业务层 dao层:数据库访问层 domain:实体包 tools:工具类 2.jar包 3.配置文件 4.程序设计 ...

  7. leetcode解题报告(21):Majority Element

    描述 Given an array of size n, find the majority element. The majority element is the element that app ...

  8. 特征工程学习01-sklearn单机特征工程

    特征工程学习01-sklearn单机特征工程 小书匠 kindle  0.数据的导入 from sklearn.datasets import load_iris  #导入IRIS数据集  iris= ...

  9. AGC037C Numbers on a Circle【构造】

    从后往前做,每次将\(B_i\)减去相邻两个数,注意如果最大的数没有变成初始状态,那么肯定要减,否则相邻两边的就减不了,所以用堆维护.根据辗转相除的复杂度,\(O(n\log^2 n)\). #inc ...

  10. 2019暑期金华集训 Day1 组合计数

    自闭集训 Day1 组合计数 T1 \(n\le 10\):直接暴力枚举. \(n\le 32\):meet in the middle,如果左边选了\(x\),右边选了\(y\)(且\(x+y\le ...