September 18th, 2002, 11:05 AM
a simple question..
I open a connection to a oracle/mysql db.
Create a statement
Create a ResultSet
execute the Resultset..
DONT close the statement..
DONT close the ResutlSet
CLOSE the connection..
Would this automatically close the statement and resultset??
September 18th, 2002, 09:23 PM
From the javadoc:
That sounds to me like everything gets closed. And I know for a fact that you can't use a ResultSet after the connection has been closed.
September 19th, 2002, 04:11 AM
but i had read somewhere that not closing the statements would leave open cursors in the database.. isnt it so?
My problem is I am opening connections to both Oracle and Mysql Databases and at the end of the script closing the connections to both..
But no matter what I do, I c that the connections are not freed at all.. In one case I open two connections to 2 diff databases in MySQL and in the Mysqlfront I see that about 40 connections are spawned/created and hardly 50 % are closed/freed at the end!!!!!
Why does this happen and how do I remedy this??
September 19th, 2002, 11:33 AM
Well, it's possible that java hasn't gotten around to garbage collecting the connections, yet. That seems like it would be horribly innefficient to me, though.