DataSourceResourceLoader doesn't close PreparedStatements
---------------------------------------------------------

                 Key: VELOCITY-760
                 URL: https://issues.apache.org/jira/browse/VELOCITY-760
             Project: Velocity
          Issue Type: Bug
          Components: Engine
    Affects Versions: 1.6.2
            Reporter: Jerome Waibel


DataSourceResourceLoader.java contains this method:

{code}
   private ResultSet readData(final Connection conn,
                               final String columnNames,
                               final String templateName) throws SQLException
    {
        PreparedStatement ps = conn.prepareStatement("SELECT " + columnNames + 
" FROM "+ tableName + " WHERE " + keyColumn + " = ?");
        ps.setString(1, templateName);
        return ps.executeQuery();
    }
{code}

PreparedStatements created in this method never get closed, only the resultset 
returned may eventually be closed later which isn't sufficient for releasing 
all bound resources. In my project this statement leak lead to the oracle 
running out of open cursors (the infamous ORA-01000 error). 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to