db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kazu Nambo (JIRA)" <j...@apache.org>
Subject [jira] Created: (TORQUE-123) Statement is left open when Exception is thrown in the QueryDataSet constructor (ORA-01000)
Date Tue, 20 Oct 2009 09:25:59 GMT
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
JDBC(Oracle): ojdbc.jar(

            Reporter: Kazu Nambo

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);
        	stmt = conn.createStatement();
        	resultSet = stmt.executeQuery(selectStmt);
        	schema = new Schema();
        	schema.populate(resultSet.getMetaData(), null);
        catch (Exception e)
        	try {
        		if (null != resultSet) {
        	} catch (Exception ignored) {}
        	try {
        		if (null != stmt) {
        	} catch (Exception ignored) {}

        	if (e instanceof SQLException)
        		throw (SQLException)e;
        	else if (e instanceof DataSetException)
        		throw (DataSetException)e;
        		throw new SQLException("QueryDataSet: exception caught.", e);

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org

View raw message