What am I doing wrong with setPrefetchRowCount? #158

RobertZito opened this Issue Mar 14, 2014 · 3 comments


None yet

2 participants


I really can not make sense of this, if you look through the code below, if I place close connection the prefetch does not work. Once I take I get 90 rows but never make it to all records processed so I know the connection did not close. What am I doing wrong here?

oracle.connect(connectData, function(err, connection) {
if (err) {
console.log("Error connecting to db:", err);
} connection.setPrefetchRowCount(90);
var reader = connection.reader("SELECT * FROM CAR", []);
function doRead(cb) {
reader.nextRow(function(err, row) {
if (err) return cb(err);
if (row) {
// do something with row
console.log("got " + JSON.stringify(row));
// recurse to read next record
return doRead(cb)
} else {
// we are done
return cb();
doRead(function(err) {
if (err) throw err; // or log it

console.log("all records processed");
//connection.close(); If this is not commentted out the //connection.setPrefetchRowCount(90); does not work.


There has to be a semicolon missing in the Basic example with setPrefetchRowCount(90), test it yourself you will not get to console.log("all records processed");


I have a similar issue using the basic example querying large table, only goes through the prefetch row count i specify and after that i get a segmenation fault (core dumped)


figured it out, had to add a connection.close() inside the else before return cb();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment