Why does JdbcRowSetImpl.close() close the database connection?

Discussion in 'Java' started by Paul van Rossem, Apr 7, 2005.

  1. (Posted this few weeks ago in c.l.j.databases, but got no reaction...)

    In my opinion it is a design flaw that JdbcRowSetImpl.close() not only
    closes the ResultSet, but also closes the database connection. The
    ResultSet.close() interface specification, i.e. the contract that
    JdbcRowSetImpl.close() should implement, does not mention this. I
    consider this also an unwanted side-effect, since the close() is a
    method of the RowSet, not of the Connection. And for instance
    CachedRowSet does as expected: not closing the connection (and usually
    can't). Any opinions on this? Or is this simply a bug?

    I would like to be able to construct several JdbcRowSets on an existing
    Connection. The JdbcRowSet(Connection) constructor suggests this is
    possible. But this becomes a hassle if closing one of the JdbcRowSets
    closes the Connection for all of them. I assume that re-opening the
    connection for each JdbcRowSet (using the JdbcRowSet.execute() method)
    causes a lot of unneeded overhead in logging in and out on the database
    server for each data fetch, which I am doing a lot. Am I right?

    I am considering to file a feature request (or even bug report?) with
    SUN to have JdbcRowSetImpl.close() only discard the dataset, and add a
    separate JdbcRowSetImpl.closeConnection() as a utility method to close
    the database connection. Any opinions on this will be greatly appreciated...

    Regards, Paul.
    Paul van Rossem, Apr 7, 2005
    #1
    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. Mr. SweatyFinger

    why why why why why

    Mr. SweatyFinger, Nov 28, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    863
    Mark Rae
    Dec 21, 2006
  2. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,764
    Smokey Grindel
    Dec 2, 2006
  3. S_K
    Replies:
    6
    Views:
    650
    Russell
    Dec 7, 2007
  4. Iñaki Baz Castillo
    Replies:
    7
    Views:
    824
    Iñaki Baz Castillo
    Jan 12, 2010
  5. hyejin
    Replies:
    8
    Views:
    328
    Martin Honnen
    Aug 29, 2006
Loading...

Share This Page