A database cursor. Cursors are used for operating on collections of records, for iterating over a database, and for saving handles to individual records, so that they can be modified after they have been read.
Cursors may be used by multiple threads, but only serially. That is, the application must serialize access to the handle.
If the cursor is to be used to perform operations on behalf of a transaction, the cursor must be opened and closed within the context of that single transaction.
Once the cursor close method has been called, the handle may not be accessed again, regardless of the close method's success or failure.
To obtain a cursor with default attributes:
Cursor cursor = myDatabase.openCursor(txn, null);
To customize the attributes of a cursor, use a CursorConfig object.
CursorConfig config = new CursorConfig(); config.setDirtyRead(true); Cursor cursor = myDatabase.openCursor(txn, config);
Modifications to the database during a sequential scan will be reflected in the scan; that is, records inserted behind a cursor will not be returned while records inserted in front of a cursor will be returned. In Queue and Recno databases, missing entries (that is, entries that were never explicitly created or that were created and then deleted) will be ignored during a sequential scan.