This discussion is archived
2 Replies Latest reply: May 1, 2012 7:02 AM by 512799 RSS

Traverse all rows of database for migration script

850455 Newbie
Currently Being Moderated
I am trying to write a custom migration script in java and I simply want to retrieve all rows from the database. I would think this would be simple but it is not working as I expected. I am trying to do it with a cursor looping while cursor.getNext is not null. This throws me in an infinite loop and doesn't seem to be stepping to the next record at all. code snippet

Cursor cursor = db.openCursor(null, null);
DatabaseEntry data = new DatabaseEntry();
DatabaseEntry key = new DatabaseEntry();

while(cursor.getNext(key, data, null) != null){
     TupleInput returnData = TupleBinding.entryToInput(data);"row: " + returnData.readString());


  • Correct Answers - 10 points
  • Helpful Answers - 5 points