Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2007

Tip: Looking for answers? Try searching our database.

Type of ResultSet

Thread view: 
Ravi - 27 Apr 2007 19:47 GMT
1. TYPE_FORWARD_ONLY - The result set is not scrollable; its cursor
moves forward only, from before the first row to after the last row.
The rows contained in the result set depend on how the underlying
database materializes the results. That is, it contains the rows that
satisfy the query at either the time the query is executed or as the
rows are retrieved.

2. TYPE_SCROLL_INSENSITIVE - The result set is scrollable; its cursor
can move both forward and backward relative to the current position,
and it can move to an absolute position.

3. TYPE_SCROLL_SENSITIVE - The result set is scrollable; its cursor
can move both forward and backward relative to the current position,
and it can move to an absolute position.

are the three types of the resultsets given in Java tutorial at Sun's
site. Whats the difference between the last two?
Carl - 27 Apr 2007 20:04 GMT
> 1. TYPE_FORWARD_ONLY - The result set is not scrollable; its cursor
> moves forward only, from before the first row to after the last row.
[quoted text clipped - 13 lines]
> are the three types of the resultsets given in Java tutorial at Sun's
> site. Whats the difference between the last two?

See the javadocs:

http://java.sun.com/j2se/1.5.0/docs/api/java/sql/ResultSet.html#TYPE_SCROLL_INSE
NSITIVE


Hope that helps.
Carl.
rhino - 27 Apr 2007 20:38 GMT
>> 1. TYPE_FORWARD_ONLY - The result set is not scrollable; its cursor
>> moves forward only, from before the first row to after the last row.
[quoted text clipped - 20 lines]
> Hope that helps.
> Carl.

In other words, a "sensitive" result set will (usually) notice changes made
to the rows in the original database table after you have built the initial
result set and make them available to you.

For example, let's say your result set contains all blue Fords registered in
the state of New York in 2007 and you create the result set at exactly 2 PM.
And let's say that you are using a GUI program and the user goes on a 15
minute coffee break just after creating the result set. Then, the user comes
back and starts scrolling through the list of blue Fords. If the result set
is sensitive, it _should_ be updated by Java to include all blue Fords
registered between 2 PM and the current time. Therefore, you will see cars
that have been registered since the result set was built. Also, let's say
that some of those blue Fords were mis-registered and they were actually
brown Fords (or blue Hondas) and someone had corrected those records between
2 PM and 2:15 PM; a sensitive result set should also reflect that some of
the cars which were believed to be blue Fords at 2 PM are actually not so
that those cars should be removed from the result set.

The disturbing thing (for me) is the word "generally" in the descriptions of
"sensitive" and "insensitive". Apparently, we cannot be absolutely sure that
all updates and deletes made to original row will be reflected in the
sensitive result set. That raises the obvious question of when we can count
on those changes being accurate and when they won't be.

--
Rhino
Martin Gregorie - 28 Apr 2007 17:18 GMT
>>> 1. TYPE_FORWARD_ONLY - The result set is not scrollable; its cursor
>>> moves forward only, from before the first row to after the last row.
[quoted text clipped - 43 lines]
> sensitive result set. That raises the obvious question of when we can count
> on those changes being accurate and when they won't be.

Thats probably a property of the database's JDBC driver. It would also
depend on whether the underlying database has mechanisms that let the
driver see when changes have been made to the logical set that contains
the selected rows.

Signature

martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.