Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Why does JdbcRowSetImpl.close() close the database connection?

Thread Tools

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

Paul van Rossem
Posts: n/a
(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.
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Database Database Database Computer Information 0 09-27-2012 02:43 AM
DataBase DataBase DataBase DataBase Computer Information 0 09-26-2012 09:40 AM
How to close a TCP socket? (TCPSocket#close doesn't close it) IƱaki Baz Castillo Ruby 7 01-12-2010 01:32 PM
this.Connection.Close(); does not close the Oracle session! Pleasehelp! S_K ASP .Net 6 12-07-2007 02:07 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM