Professional Web Applications Themes

JDBC ResultSet - Where is its stored? DB2 client app or Java program's JVM? - IBM DB2

When a Java program executes a SQL query using JDBC, is the ResultSet data stored in the DB2 Client process or in the JVM for the Java program? The DB2 jdbc driver requires client code on the client machine (in other words, it is not a thin driver). Because of this, we were wondering if the ResultSet data is stored in the DB2 client process. For instance, let's say the fetch size is 100 rows for a SQL query. Once this query is executed, are these 100 records stored in the DB2 client process or are they stored in the ...

  1. #1

    Default JDBC ResultSet - Where is its stored? DB2 client app or Java program's JVM?

    When a Java program executes a SQL query using JDBC, is the ResultSet
    data stored in the DB2 Client process or in the JVM for the Java
    program? The DB2 jdbc driver requires client code on the client
    machine (in other words, it is not a thin driver). Because of this, we
    were wondering if the ResultSet data is stored in the DB2 client
    process. For instance, let's say the fetch size is 100 rows for a SQL
    query. Once this query is executed, are these 100 records stored in
    the DB2 client process or are they stored in the JVM's memory of the
    Java application?
    Ricardo Guest

  2. #2

    Default Re: JDBC ResultSet - Where is its stored? DB2 client app or Javaprogram's JVM?



    Ricardo wrote:
    > When a Java program executes a SQL query using JDBC, is the ResultSet
    > data stored in the DB2 Client process or in the JVM for the Java
    > program? The DB2 jdbc driver requires client code on the client
    > machine (in other words, it is not a thin driver). Because of this, we
    > were wondering if the ResultSet data is stored in the DB2 client
    > process. For instance, let's say the fetch size is 100 rows for a SQL
    > query. Once this query is executed, are these 100 records stored in
    > the DB2 client process or are they stored in the JVM's memory of the
    > Java application?
    I think the result set is stored in the Java Heap, like what you said
    "JVM's memory".
    Regards,
    Fan Ruoxin

    Fan Ruo Xin Guest

  3. #3

    Default Re: JDBC ResultSet - Where is its stored? DB2 client app or Javaprogram's JVM?

    W Gemini wrote:
    > Fan Ruo Xin wrote:
    >
    >>
    >> Ricardo wrote:
    >>
    >>
    >>> When a Java program executes a SQL query using JDBC, is the ResultSet
    >>> data stored in the DB2 Client process or in the JVM for the Java
    >>> program? The DB2 jdbc driver requires client code on the client
    >>> machine (in other words, it is not a thin driver). Because of this, we
    >>> were wondering if the ResultSet data is stored in the DB2 client
    >>> process. For instance, let's say the fetch size is 100 rows for a SQL
    >>> query. Once this query is executed, are these 100 records stored in
    >>> the DB2 client process or are they stored in the JVM's memory of the
    >>> Java application?
    >>
    >>
    >>
    >> I think the result set is stored in the Java Heap, like what you said
    >> "JVM's memory".
    >> Regards,
    >> Fan Ruoxin
    >>
    >
    > I doubt it. If the resultsets contains a million rows, you can hardly
    > store it in memory. Most likely a resultset would just work like a
    > cursor and would drive subsequent fetch request back to the database.
    >
    Correct, a result set will contain some of the row data if they are
    blocked cursors, but not in the jvms heap; in the heap we just have the
    actual result set object. Most of the cached data is from private memory.

    Sean McKeough Guest

  4. #4

    Default Re: JDBC ResultSet - Where is its stored? DB2 client app orJavaprogram's JVM?



    W Gemini wrote:
    > Fan Ruo Xin wrote:
    > >
    > > Ricardo wrote:
    > >
    > >
    > >>When a Java program executes a SQL query using JDBC, is the ResultSet
    > >>data stored in the DB2 Client process or in the JVM for the Java
    > >>program? The DB2 jdbc driver requires client code on the client
    > >>machine (in other words, it is not a thin driver). Because of this, we
    > >>were wondering if the ResultSet data is stored in the DB2 client
    > >>process. For instance, let's say the fetch size is 100 rows for a SQL
    > >>query. Once this query is executed, are these 100 records stored in
    > >>the DB2 client process or are they stored in the JVM's memory of the
    > >>Java application?
    > >
    > >
    > > I think the result set is stored in the Java Heap, like what you said
    > > "JVM's memory".
    > > Regards,
    > > Fan Ruoxin
    > >
    >
    > I doubt it. If the resultsets contains a million rows, you can hardly
    > store it in memory. Most likely a resultset would just work like a
    > cursor and would drive subsequent fetch request back to the database.
    First I'd like to say I agree with you. I didn't say my opnion clearly. I
    supposed the original poster ask this question focus on the client side. His
    concern is if the result set is save in the db2 client process, then that's
    impossible to support thin JDBC driver.
    My opnion is even you use type-2 JDBC driver, that means before you run your
    java program, you need install db2 client code, there is no a separate db2
    client process. The java application is db2 client process who will talk to
    db2 coordinator agent (not net JDBC driver) on the db2 server side. So when
    a JAVA application call "select * from mytable ...", yes the result set will
    be stored in the server side (and if it is bigger enough, then could flush
    to disk - a temporary table), and is triggered by the next fetch request
    ....Either each time the server send back one row or a block of rows, in
    client side there must be a place to hold/cache this row or block, what I
    mean is this part will be stored in the JAVA application's memory.
    Thanks,
    Fan Ruoxin

    Fan Ruo Xin Guest

  5. #5

    Default Re: JDBC ResultSet - Where is its stored? DB2 client app orJavaprogram's JVM?



    Sean McKeough wrote:
    > W Gemini wrote:
    >
    > > Fan Ruo Xin wrote:
    > >
    > >>
    > >> Ricardo wrote:
    > >>
    > >>
    > >>> When a Java program executes a SQL query using JDBC, is the ResultSet
    > >>> data stored in the DB2 Client process or in the JVM for the Java
    > >>> program? The DB2 jdbc driver requires client code on the client
    > >>> machine (in other words, it is not a thin driver). Because of this, we
    > >>> were wondering if the ResultSet data is stored in the DB2 client
    > >>> process. For instance, let's say the fetch size is 100 rows for a SQL
    > >>> query. Once this query is executed, are these 100 records stored in
    > >>> the DB2 client process or are they stored in the JVM's memory of the
    > >>> Java application?
    > >>
    > >>
    > >>
    > >> I think the result set is stored in the Java Heap, like what you said
    > >> "JVM's memory".
    > >> Regards,
    > >> Fan Ruoxin
    > >>
    > >
    > > I doubt it. If the resultsets contains a million rows, you can hardly
    > > store it in memory. Most likely a resultset would just work like a
    > > cursor and would drive subsequent fetch request back to the database.
    > >
    >
    > Correct, a result set will contain some of the row data if they are
    > blocked cursors, but not in the jvms heap; in the heap we just have the
    > actual result set object. Most of the cached data is from private memory.
    Thank you, Sean. I suppose you talk the client part. The cached data will be
    in the Java application's memory, but not memory heap part. I was wrong for
    this issue.
    BTW, when we run Java application server (using type-2 jdbc driver talk to db2
    server), I didn't surprise that we need increase the appl heap size, but why
    it always complain the appl control heap not big enough. We didn't use
    intral_parallelism, inter_parallelism, connection concentrator...
    This is not a big issue, it is easy to adjust the appl control heap size. The
    point is I am the person who want to know why. TIA.
    Regards,
    Fan Ruoxin

    Fan Ruo Xin Guest

  6. #6

    Default Re: JDBC ResultSet - Where is its stored? DB2 client app or Javaprogram'sJVM?

    Inline below...

    Ricardo wrote:
    > Fan Ruo Xin <fanruoxsbcglobal.net> wrote in message news:<3F207CA5.2CFA1587sbcglobal.net>...
    >
    >>W Gemini wrote:
    >>
    >>
    >>>Fan Ruo Xin wrote:
    >>>
    >>>>Ricardo wrote:
    >>>>
    >>>>
    >>>>
    >>>>>When a Java program executes a SQL query using JDBC, is the ResultSet
    >>>>>data stored in the DB2 Client process or in the JVM for the Java
    >>>>>program? The DB2 jdbc driver requires client code on the client
    >>>>>machine (in other words, it is not a thin driver). Because of this, we
    >>>>>were wondering if the ResultSet data is stored in the DB2 client
    >>>>>process. For instance, let's say the fetch size is 100 rows for a SQL
    >>>>>query. Once this query is executed, are these 100 records stored in
    >>>>>the DB2 client process or are they stored in the JVM's memory of the
    >>>>>Java application?
    >>>>
    >>>>
    >>>>I think the result set is stored in the Java Heap, like what you said
    >>>>"JVM's memory".
    >>>>Regards,
    >>>>Fan Ruoxin
    >>>>
    >>>
    >>>I doubt it. If the resultsets contains a million rows, you can hardly
    >>>store it in memory. Most likely a resultset would just work like a
    >>>cursor and would drive subsequent fetch request back to the database.
    >>
    >>First I'd like to say I agree with you. I didn't say my opnion clearly. I
    >>supposed the original poster ask this question focus on the client side. His
    >>concern is if the result set is save in the db2 client process, then that's
    >>impossible to support thin JDBC driver.
    >>My opnion is even you use type-2 JDBC driver, that means before you run your
    >>java program, you need install db2 client code, there is no a separate db2
    >>client process. The java application is db2 client process who will talk to
    >>db2 coordinator agent (not net JDBC driver) on the db2 server side. So when
    >>a JAVA application call "select * from mytable ...", yes the result set will
    >>be stored in the server side (and if it is bigger enough, then could flush
    >>to disk - a temporary table), and is triggered by the next fetch request
    >>...Either each time the server send back one row or a block of rows, in
    >>client side there must be a place to hold/cache this row or block, what I
    >>mean is this part will be stored in the JAVA application's memory.
    >>Thanks,
    >>Fan Ruoxin
    >
    >
    > Fan, thanks for your reply. This is exactly what I was trying to
    > understand. So, you are saying that even though we are using a jdbc
    > type2 driver, there is no separate db2 client process (besides my Java
    > applicaition) running on my client machine.
    >
    > Could you confirm that the following is true?
    >
    > 1) A Java application that uses a jdbc type 2 driver to connect to DB2
    > loads into memory the client code that was installed as part of the
    > jdbc driver.
    > The only db2 client process that runs on the client machine is the
    > Java application itself. In other words, there is no such a thing as a
    > separate db2 client process to which my Java application connects to
    > in order to get the data from the database.
    Yes, your java application is the only client process. With the type 2
    driver however, you will load in our C app library (libdb2.a cli libs etc).
    >
    > 3) Since my Java application is the only db2 client side application,
    > then the result set data is stored on the server side and when I
    > invoke methods like ResultSet.absolute() or ResultSet.last(), the
    > change in position of the cursor happens on the server side and not
    > over some data structure in memory on the client side.
    >
    If your cursor is a blocking cursor, then more than 1 row of data is
    returned to the client at a time. You will return to the server when the
    client has exahusted their cache of rows. The server knows the position
    of the cursor with respect to the last set of data returned to the app.
    > Thanks.
    Sean McKeough Guest

Similar Threads

  1. Mapping Java ResultSet to Flex
    By Anurag Mishra in forum Macromedia Flex General Discussion
    Replies: 1
    Last Post: January 4th, 08:55 AM
  2. java ResultSet size
    By monty in forum MySQL
    Replies: 2
    Last Post: September 30th, 09:13 AM
  3. Caching a resultset from a stored procedure
    By zax_srb in forum Coldfusion Database Access
    Replies: 0
    Last Post: January 26th, 03:15 PM
  4. Stored Procedures JDBC
    By mighty wayward in forum Coldfusion - Advanced Techniques
    Replies: 6
    Last Post: June 14th, 11:00 AM
  5. Stored Procedure not returning the wanted resultset
    By Henning Kongsgaard in forum Microsoft SQL / MS SQL Server
    Replies: 2
    Last Post: July 4th, 08:01 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139