Join David Gassner for an in-depth discussion in this video Moving the cursor in scrollable result sets, part of Java Database Integration with JDBC.
- View Offline
By default, result sets are forward only, that is, the cursor starts before the first…row of data and can only move forward once.…But a scrollable ResultSet gives you the ability to move back and forth in the result set as needed.…You can make the ResultSet scrollable with most database management systems and different…database management systems have different rules.…For example, MySQL using the Connector/J returns a result set that scrollable by default.…But HSQLDB can do a scrollable ResultSet, but you have to say you want it.…
You select the ability to scroll the data set when you create the Statement object.…In this code I'm creating the Statement with the CreateStatement method, and I'm passing…in a type of TYPE_SCROLL_INSENSITIVE.…The ResultSet type can be scrollable or forward only, it can also be READ_ONLY or updatable,…and it is possible to have a scrollable ResultSet that also updatable if you combine these properties in the right way.…Once you have gotten a scrollable ResultSet into memory you can move the cursor that is…
Author David Gassner explains how to choose a JDBC driver and connect to one or more databases. He also provides detailed instructions on reading, selecting, and updating data; calling stored procedures; managing data via JavaBean classes or with prepared statements; and working with metadata.
- Importing a MySQL database
- Connecting to databases
- Handling JDBC exceptions
- Looping through result sets
- Limiting the number of fetched rows
- Filtering data with prepared statements
- Calling stored procedures
- Inserting, updating, and deleting rows with prepared statements
- Using a persistent database connection
- Committing and rolling back transactions