resultset an iterator?

Discussion in 'Java' started by mistral, May 18, 2004.

  1. mistral

    mistral Guest

    Hello,

    1)If a execute a statement : SELECT * FROM balaba.
    And I retrieve this statement as a resultset. Then is this result set
    totally filled with the table => the resultset contains the whole table
    blabla.
    OR is this just an interator and every time I do a next the database is
    contacted and the next record  is retrieved.

    This is important because you don't want a whole db table in your memory :)

    2) Is the com.mysql.jdbc.resultset better than java.sql.resultset?


    Thanks !


    Tom
     
    mistral, May 18, 2004
    #1
    1. Advertising

  2. mistral wrote:
    > Hello,
    >
    > 1)If a execute a statement : SELECT * FROM balaba.
    > And I retrieve this statement as a resultset. Then is this result set
    > totally filled with the table => the resultset contains the whole table
    > blabla.
    > OR is this just an interator and every time I do a next the database is
    > contacted and the next record is retrieved.


    That's an implementation detail of the JDBC driver.

    > This is important because you don't want a whole db table in your memory :)


    You don't want a network roundtrip for each single row either, that would probably
    be worse in most cases. A good JDBC driver should fetch the rows in reasonable
    chunks (maybe 100) at a time. This is even configurable somewhere in JDBC, but
    I remember reading somewhere that most JDBC drivers do indeed fetch the entire
    table, and it's not that much of a problem. After all, you very rately do an
    unqualified select on a really big table - what would you do with the result,
    after all?

    > 2) Is the com.mysql.jdbc.resultset better than java.sql.resultset?


    I suspect that it is simply an implementation of java.sql.resultset, which
    is an interface.
     
    Michael Borgwardt, May 18, 2004
    #2
    1. Advertising

  3. mistral

    mistral Guest

    Michael Borgwardt wrote:

    > mistral wrote:
    >> Hello,
    >>
    >> 1)If a execute a statement : SELECT * FROM balaba.
    >> And I retrieve this statement as a resultset. Then is this result set
    >> totally filled with the table => the resultset contains the whole table
    >> blabla.
    >> OR is this just an interator and every time I do a next the database is
    >> contacted and the next record is retrieved.

    >
    > That's an implementation detail of the JDBC driver.
    >
    >> This is important because you don't want a whole db table in your memory
    >> :)

    >
    > You don't want a network roundtrip for each single row either, that would
    > probably be worse in most cases. A good JDBC driver should fetch the rows
    > in reasonable chunks (maybe 100) at a time. This is even configurable
    > somewhere in JDBC, but I remember reading somewhere that most JDBC drivers
    > do indeed fetch the entire table, and it's not that much of a problem.
    > After all, you very rately do an unqualified select on a really big table
    > - what would you do with the result, after all?


    >> 2) Is the com.mysql.jdbc.resultset better than java.sql.resultset?

    >
    > I suspect that it is simply an implementation of java.sql.resultset, which
    > is an interface.


    Ok thank you !
     
    mistral, May 18, 2004
    #3
  4. mistral

    mistral Guest

    mistral wrote:

    > Hello,
    >
    > 1)If a execute a statement : SELECT * FROM balaba.
    > And I retrieve this statement as a resultset. Then is this result set
    > totally filled with the table => the resultset contains the whole table
    > blabla.
    > OR is this just an interator and every time I do a next the database is
    > contacted and the next record  is retrieved.
    >
    > This is important because you don't want a whole db table in your memory
    > :)
    >
    > 2) Is the com.mysql.jdbc.resultset better than java.sql.resultset?
    >
    >
    > Thanks !
    >
    >
    > Tom



    The solution for this problem is discussed in comp.lang.java.databases.
     
    mistral, May 18, 2004
    #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. Hendrik Maryns
    Replies:
    18
    Views:
    1,448
  2. greg
    Replies:
    6
    Views:
    468
    Dietmar Kuehl
    Jul 17, 2003
  3. Replies:
    6
    Views:
    665
    Jim Langston
    Oct 30, 2005
  4. Steven D'Aprano

    What makes an iterator an iterator?

    Steven D'Aprano, Apr 18, 2007, in forum: Python
    Replies:
    28
    Views:
    1,215
    Steven D'Aprano
    Apr 20, 2007
  5. David Bilsby
    Replies:
    5
    Views:
    2,066
    David Bilsby
    Oct 9, 2007
Loading...

Share This Page