DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17301>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17301 NPE in Oracle driver when using DBCP PoolingDataSource Summary: NPE in Oracle driver when using DBCP PoolingDataSource Product: Commons Version: Nightly Builds Platform: PC OS/Version: Windows NT/2K Status: NEW Severity: Normal Priority: Other Component: Dbcp AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] Using the following code fragment: // m_pool is a PoolingDataSource Connection conn = m_pool.getConnection(); PreparedStatement stmt = conn.prepareStatement("select * from foo", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); ResultSet rs = stmt.executeQuery(); while (rs.next()) { // Do something } stmt.close() // NPE happens here conn.close(); I get the following NPE: java.lang.NullPointerException at oracle.jdbc.driver.ScrollableResultSet.close (ScrollableResultSet.java:143) at org.apache.commons.dbcp.DelegatingResultSet.close (DelegatingResultSet.java:146) at org.apache.commons.dbcp.DelegatingPreparedStatement.passivate (DelegatingPreparedStatement.java:270) at org.apache.commons.dbcp.DelegatingPreparedStatement.close (DelegatingPreparedStatement.java:157) I believe this happens because calling close() on DelegatingPreparedStatement winds up calling close() on Oracle's ScrollableResultSet object more than once (once as a result of DelegatingPreparedStatement calling close() on the wrapped PreparedStatement, and the second time as a result of calling close() on DelegatingResultSet, in DelegatingPreparedStatement.passivate()). When I de- compile the Oracle driver it seems that calling close() more than once on a ScrollableResultSet will always result in an NPE. I tried the above with default ResultSet type and concurrency, i.e.: PreparedStatement stmt = conn.prepareStatement("select * from foo"); and could not reproduce. I believe that this is because a different Oracle ResultSet implementation (OracleResultSetImpl) is used in the default case. I also tried both these cases against v1.0 DBCP and could not reproduce at all. So, something changed between 1.0 in Aug 2002 and the present that is responsible. I spent some time looking for a cause with no luck. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
