This discussion is archived
1 Reply Latest reply: May 19, 2012 11:59 AM by greybird RSS

cursor woes

938426 Newbie
Currently Being Moderated
hello all.

sorry for such a noob question ... but new to berkeley db je.

i am using the base api, and have basic db creation and insertion (serialized objects) working.

when i go to retrieve data, i can get single items just fine.

but when i try to make a cursor, and iterate though the cursor (say with getNext())
the first few records found seem to be ?garbage?

if i skip over them, with something like
int loop = 0;
while( myCursor.getNext( key, data, LockMode.DEFAULT ) == OperationStatus.SUCCESS ){

if( loop <= 2 ){

// de-serialize here ...


then the de-serialize works great, and i am de-serializing all the items that i 'think' put 'in' (ass/u/ming i am not the one putting in the garbage).

without the skipover i get corrupted stream errors, i think the data value is null that i am passing into the

mmm ... couple of hints

i am running in memory only mode.
i open the db(s) and env.
load the db.
try to read the db.
then close everything db(s), env, ect ...

well, any hints would be greatly appreciated



  • 1. Re: cursor woes
    greybird Expert
    Currently Being Moderated

    You'll need to do a little more debugging and/or post the code that's doing the writing, serialization and deserialization.



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