You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by Hendrik Busch <he...@lexisnexis.de> on 2005/03/18 10:23:42 UTC
Missing close-operations for Statements
Hi!
We are currently porting major pieces of our software from MySQL to
Oracle. I'm currently stuck with the Oracle "too many open cursors"
failure. Having checked our own software first I have checked the Torque
sources next.
The most notable thing I found when searching for unclosed
JDBC-resources were the missing close()-calla to the Statements used in
the many DB adapters, including the Oracle adapter. Most methods look
like this:
public void lockTable(Connection con, String table) throws SQLException
{
Statement statement = con.createStatement();
StringBuffer stmt = new StringBuffer();
stmt.append("SELECT next_id FROM ")
.append(table)
.append(" FOR UPDATE");
statement.executeQuery(stmt.toString());
}
The used statement does remain open. Was this done on purpose with an
intention I don't see or did someone simply forget to close the
Statements? Since we are performing database operations with a very high
rate, those things sometimes tend to cause problems.
--
Mit freundlichen Grüßen / Kind regards
Hendrik Busch - Senior Developer
LexisNexis Deutschland GmbH
http://www.lexisnexis.de
Feldstiege 100
D-48161 Münster
phone +49 (0) 2533-9300-455
fax +49 (0) 02533-9300-50
hendrik.busch@lexisnexis.de
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org
Re: Missing close-operations for Statements
Posted by Hendrik Busch <he...@lexisnexis.de>.
Hi!
> I cannot imagine a reason why the statement should not be closed. However,
> I have looked for references to the lockTable code and found none. So I do
> not think this is the cause for your problem.
Thanks!
I found the cause somewhere else: Village which is used by Torque does
not close every ResultSet it opens. The two classes Record and Schema
open ResultSets that are never closed afterwards. Now that we fixed
this, our Oracle Exception is gone :-).
--
Mit freundlichen Grüßen / Kind regards
Hendrik Busch - Senior Developer
LexisNexis Deutschland GmbH
http://www.lexisnexis.de
Feldstiege 100
D-48161 Münster
phone +49 (0) 2533-9300-455
fax +49 (0) 02533-9300-50
hendrik.busch@lexisnexis.de
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org
RE: Missing close-operations for Statements
Posted by Thomas Fischer <fi...@seitenbau.net>.
Hendrik,
I cannot imagine a reason why the statement should not be closed. However,
I have looked for references to the lockTable code and found none. So I do
not think this is the cause for your problem.
I have tested that the runtimetest on oracle works without the lockTable
and unlockTable methods in DB.java and the respective adapter (Oracle, in
my case).
I would like to deprecate the methods from the adapter and mark them as
being deleted in a future release. Does anybody have any objections to that
?
Thomas
Hendrik Busch <he...@lexisnexis.de> schrieb am 18.03.2005 10:23:42:
> Hi!
>
> We are currently porting major pieces of our software from MySQL to
> Oracle. I'm currently stuck with the Oracle "too many open cursors"
> failure. Having checked our own software first I have checked the Torque
> sources next.
> The most notable thing I found when searching for unclosed
> JDBC-resources were the missing close()-calla to the Statements used in
> the many DB adapters, including the Oracle adapter. Most methods look
> like this:
>
> public void lockTable(Connection con, String table) throws SQLException
> {
> Statement statement = con.createStatement();
>
> StringBuffer stmt = new StringBuffer();
> stmt.append("SELECT next_id FROM ")
> .append(table)
> .append(" FOR UPDATE");
>
> statement.executeQuery(stmt.toString());
> }
>
> The used statement does remain open. Was this done on purpose with an
> intention I don't see or did someone simply forget to close the
> Statements? Since we are performing database operations with a very high
> rate, those things sometimes tend to cause problems.
>
> --
> Mit freundlichen Grüßen / Kind regards
>
> Hendrik Busch - Senior Developer
>
> LexisNexis Deutschland GmbH
> http://www.lexisnexis.de
> Feldstiege 100
> D-48161 Münster
> phone +49 (0) 2533-9300-455
> fax +49 (0) 02533-9300-50
> hendrik.busch@lexisnexis.de
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-dev-help@db.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org