JDBC ResultSet Scroll Sensitive Type and Result Set Scroll Insensitive Type

can someone tell me the difference between JDBC ResultSet Scroll Sensitive Type and Result Set Scroll Insensitive Type?

Where do we usually use them in projects?

+6
source share
3 answers

The type of the ResultSet object determines its level of functionality in two areas: how the cursor is manipulated and how parallel changes made to the underlying data source are reflected by the ResultSet object.

TYPE_SCROLL_INSENSITIVE :

The result can be scrolled; his cursor can move both forward and backward relative to the current position, and he can move to an absolute position. The result set is insensitive to changes made to the main data source while it is open. It contains strings that satisfy the query either during the execution of the query or how the rows are retrieved.

TYPE_SCROLL_SENSITIVE :

The result can be scrolled; his cursor can move both forward and backward relative to the current position, and he can move to an absolute position. The result set reflects the changes made to the underlying data source while the result set remains open.

See the javase tutorial for more details.

+6
source

ResultSet Scroll Sensitive Type ( TYPE_SCROLL_SENSITIVE ): indicates that the result set scrolls in any direction and is affected by changes made by other transactions or operators within the same transaction.

Result Set Scroll Insensitive Type ( TYPE_SCROLL_INSENSITIVE ): indicates that the result set scrolls in any direction, but is insensitive to changes made by other transactions or other operators in the same transaction.

Also check out javadoc

+4
source

scrollable resultset (TYPE_SCROLL_SENSITIVE) and non-scrollable resultset (TYPE_SCROLL_INSENSITIVE) are two types of Resultset objects based on their sensitivity. Resultset is an object used to access a database from a Java EE application.

The ResultSet object has a cursor that does not initially point to any record. Call the ResultSet first () function to move the cursor to the first record stored in the ResultSet object. The ResultSet get functions provide access to the contents of each column using the column name from the database table.

A non-scrollable result set can only be moved in the forward direction from the first to the last element, and also cannot be moved directly to any row in the database.

While the set of scrollable results can move in both directions, that is, forward or backward, and can also point to any row in the database at any given time, which makes it much more flexible.

Link: difference between scrollable ResultSet and non-scroll ResultSet?

0
source

Source: https://habr.com/ru/post/922045/


All Articles