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 "Thomas Vandahl (JIRA)" <ji...@apache.org> on 2011/03/06 20:11:59 UTC
[jira] Closed: (TORQUE-123) Statement is left open when Exception
is thrown in the QueryDataSet constructor (ORA-01000)
[ https://issues.apache.org/jira/browse/TORQUE-123?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Thomas Vandahl closed TORQUE-123.
---------------------------------
Fixed in village-3.3.1
> Statement is left open when Exception is thrown in the QueryDataSet constructor (ORA-01000)
> ---------------------------------------------------------------------------------------------
>
> Key: TORQUE-123
> URL: https://issues.apache.org/jira/browse/TORQUE-123
> Project: Torque
> Issue Type: Bug
> Components: Village
> Affects Versions: 3.3
> Environment: OS :RedHat Enterprise Linux ES 4 update 4
> Java :1.4.2_08
> Tomcat:4.1.31
> Torque:3.0.2
> JDBC(Oracle): ojdbc.jar(10.2.0.4)
> Reporter: Kazu Nambo
> Assignee: Thomas Fox
> Fix For: 3.3.1
>
>
> When syntax error(SQLException) happens at executeQuery in the constructor QueryDataSet(Connection conn, String selectStmt), the member stmt is left open and this problem sometimes results in ORA-01000 (Maximum open cursors exceeded).
> In the upper layer like BasePeer#executeQuery method, it tries to close QueryDataSet instance by VillageUtils.close but it fails because the instance is null.
> Other exceptions may result in the same situation.
> If I try to make the constructor more robust as follows, it will work. (No ORA-01000)
> public QueryDataSet(Connection conn, String selectStmt)
> throws SQLException, DataSetException
> {
> this.conn = conn;
> selectString = new StringBuffer(selectStmt);
> try
> {
> stmt = conn.createStatement();
> resultSet = stmt.executeQuery(selectStmt);
> schema = new Schema();
> schema.populate(resultSet.getMetaData(), null);
> }
> catch (Exception e)
> {
> try {
> if (null != resultSet) {
> resultSet.close();
> }
> } catch (Exception ignored) {}
> try {
> if (null != stmt) {
> stmt.close();
> }
> } catch (Exception ignored) {}
> if (e instanceof SQLException)
> throw (SQLException)e;
> else if (e instanceof DataSetException)
> throw (DataSetException)e;
> else
> throw new SQLException("QueryDataSet: exception caught.", e);
> }
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org