Type of ResultSet

Discussion in 'Java' started by Ravi, Apr 27, 2007.

  1. Ravi

    Ravi Guest

    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?
    Ravi, Apr 27, 2007
    #1
    1. Advertising

  2. Ravi

    Carl Guest

    On Apr 27, 11:47 am, Ravi <> wrote:
    > 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?


    See the javadocs:

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

    Hope that helps.
    Carl.
    Carl, Apr 27, 2007
    #2
    1. Advertising

  3. Ravi

    rhino Guest

    "Carl" <> wrote in message
    news:...
    > On Apr 27, 11:47 am, Ravi <> wrote:
    >> 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?

    >
    > See the javadocs:
    >
    > http://java.sun.com/j2se/1.5.0/docs/api/java/sql/ResultSet.html#TYPE_SCROLL_INSENSITIVE
    >
    > 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
    rhino, Apr 27, 2007
    #3
  4. rhino wrote:
    > "Carl" <> wrote in message
    > news:...
    >> On Apr 27, 11:47 am, Ravi <> wrote:
    >>> 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?

    >> See the javadocs:
    >>
    >> http://java.sun.com/j2se/1.5.0/docs/api/java/sql/ResultSet.html#TYPE_SCROLL_INSENSITIVE
    >>
    >> 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.
    >

    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.


    --
    martin@ | Martin Gregorie
    gregorie. | Essex, UK
    org |
    Martin Gregorie, Apr 28, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matrix
    Replies:
    0
    Views:
    571
    Matrix
    Apr 1, 2004
  2. matrix ¿ìÀÖÄñ

    How i know the size of "resultset"?

    matrix ¿ìÀÖÄñ, Apr 3, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    3,431
    matrix ¿ìÀÖÄñ
    Apr 3, 2004
  3. =?Utf-8?B?VGltX2s=?=

    Web Treeview loaded from resultset example

    =?Utf-8?B?VGltX2s=?=, Jun 18, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    338
    =?Utf-8?B?VGltX2s=?=
    Jun 18, 2004
  4. =?Utf-8?B?VGltX2s=?=

    Web Treeview loaded from resultset example

    =?Utf-8?B?VGltX2s=?=, Jun 18, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    256
    =?Utf-8?B?VGltX2s=?=
    Jun 18, 2004
  5. Joe via DotNetMonster.com

    Multiple Select Statements in resultset

    Joe via DotNetMonster.com, Mar 26, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    8,189
    Jim via DotNetMonster.com
    Mar 27, 2005
Loading...

Share This Page