Tim Dudgeon wrote: > Phil Steitz wrote: >> Tim Dudgeon wrote: >>> I'm getting an strange problem with ORA-01453 errors on connections >>> retrieved from the pool that I'm having difficulty resolving. >>> There is some info on the web about this, but I can't find any >>> solutions. It is described in places as a DBCP bug, but I can't be sure. >>> >>> I _think_ the problem is like this (can't be 100% sure of this): >>> >>> 1. A SQLException happens during a previous operation. >>> 2. This connection gets returned to the pool in a bad state >>> 3. A new operation is started within a transaction (I think this must >>> use the non-default isolation level) and this "bad" connection is >>> obtained from the pool. >>> 4. The isolation level tries to be set and you get an error like this: >> >> Do you have testOnBorrow or testOnReturn set to true? Do you have a >> validationQuery defined? > > Neither are defined.
Try setting testOnBorrow=true and supplying a validationQuery. This will cause connections to be validated when they are borrowed from the pool. Phil > >> >> Also, what versions of DBCP (stack trace looks like 1.2.2?) and POOL >> are you using? See https://issues.apache.org/jira/browse/DBCP-308 >> for a related bug that was fixed in DBCP 1.3/1.4; but it looks to me >> like you are facing a different problem. One more question: What >> Oracle driver? > > I'm using 1.3, but the same problems is seen with 1.2.2. > Pool version is 1.5.4 (with DBCP 1.3) or 1.5.2 (with 1.2.2). > Oracle driver version is 11.1.0.7.0. > > Tim > >> >> Phil >>> java.sql.SQLException: ORA-01453: SET TRANSACTION must be first >>> statement of transaction >>> at >>> oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70) >>> >>> at >>> oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:131) >>> at >>> oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:204) >>> >>> at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455) >>> at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413) >>> at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1034) >>> at >>> oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:183) >>> at >>> oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:942) >>> at >>> oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1222) >>> >>> >>> at >>> oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1770) >>> >>> >>> at >>> oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1739) >>> at >>> oracle.jdbc.driver.OracleStatementWrapper.execute(OracleStatementWrapper.java:299) >>> >>> >>> at >>> oracle.jdbc.driver.PhysicalConnection.setTransactionIsolation(PhysicalConnection.java:4053) >>> >>> >>> at >>> org.apache.commons.dbcp.DelegatingConnection.setTransactionIsolation(DelegatingConnection.java:340) >>> >>> >>> at >>> org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.setTransactionIsolation(PoolingDataSource.java:332) >>> >>> >>> at >>> org.apache.commons.dbcp.DelegatingConnection.setTransactionIsolation(DelegatingConnection.java:340) >>> >>> >>> at >>> org.springframework.jdbc.datasource.DataSourceUtils.prepareConnectionForTransaction(DataSourceUtils.java:174) >>> >>> >>> at >>> org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:210) >>> >>> >>> >>> >>> >>> Does this make any sense, and is there a solution? >>> >>> Thanks >>> Tim >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [email protected] >>> For additional commands, e-mail: [email protected] >>> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
