commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Rupsch <Alexander.Rup...@gmx.de>
Subject stmt.getConnection() != Connection used to create the statement
Date Tue, 16 Aug 2005 21:26:00 GMT
Hi,

I'm not an expert in implementing connection pools or jdbc itself. But
shouldn't the following code work?

Connection con = pool.getConnection()
PreparedStatement ps = con.prepareStatement()

con.equals(ps.getConnection) // returns false!

Ok, I don't need it to be equal, but the following also does not work:

ps.getConnection().close()
con.isClosed() // is false!!!

That means, if I have a Statment and want to close its connection, I
have to remember the conncetion by myself. Is that the requested
behavior? Because of this my pool was running over.

The java.sql API says that Statment.getConnection() has to be the
connection which created the statement.

regards.

-- 
Alexander Rupsch
http://www.dreinhalb.de

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message