ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philippe Laflamme" <philippe.lafla...@mail.mcgill.ca>
Subject RE: Error accessing SimplePooledConnection. Connection has been invalidated
Date Tue, 18 Jan 2005 17:38:13 GMT
Hi Clinton, 

> You should NEVER be calling 
> daoManager.startTransaction from WITHIN a DAO.

I totaly agree. I remember when we started our project that we hit a similar
problem. We realized our mistake and quickly modified our pattern. I don't
remember seeing this advice anywhere in the documentation though; is it
documented somewhere? It could help steer new users in the right direction.
I could open an issue on this if its not documented...

Regards,
Philippe

> -----Original Message-----
> From: Clinton Begin [mailto:clinton.begin@gmail.com] 
> Sent: January 18, 2005 12:22 PM
> To: ibatis-user-java@incubator.apache.org
> Subject: Re: Error accessing SimplePooledConnection. 
> Connection has been invalidated
> 
> 
> Oh, well, that was your problem.  You should NEVER be calling 
> daoManager.startTransaction from WITHIN a DAO.
> 
> That's a very bad thing... :-(
> 
> Clinton
> 
> 
> On Tue, 18 Jan 2005 11:12:53 -0600, stevem@teamics.com 
> <stevem@teamics.com> wrote:
> > The getConnection() method was from 
> > com.ibatis.dao.client.template.JdbcDaoTemplate.  I decided NOT to 
> > extend JdbcDaoTemplate and write my own getConnection() 
> method to get 
> > around the problem.  Life is good now.
> > 
> > 
> > -----Clinton Begin <clinton.begin@gmail.com> wrote: -----
> > 
> > To: ibatis-user-java@incubator.apache.org
> > From: Clinton Begin <clinton.begin@gmail.com>
> > Date: 01/18/2005 10:12AM
> > Subject: Re: Error accessing SimplePooledConnection. Connection has 
> > been invalidated
> > 
> > 
> > What is in getConnection() ???
> > 
> > Clinton
> > 
> > 
> > On Tue, 18 Jan 2005 09:28:56 -0600, stevem@teamics.com
> >  wrote:
> > > Can you mix DAO implementations?  I am in a restrictive Oracle 
> > > environment that prevents me from deploying the Default 
> CLOB support 
> > > using the Oracle
> > 10
> > > JDBC drivers (which works great, by the way).  The 
> client's servers 
> > > still have Oracle 8i drivers (go figure).  I re-wrote the 
> affected 
> > > DAO as a JDBC DAO, but the code (below) results in the attached 
> > > error.  I'm not finding much help on the web.  I tried 
> changing to a 
> > > JDBC transaction manager, but that broke my SqlMap DAOs.
> > >  
> > >      private void insert(ProductRequirement pr) {
> > >          Connection conn = null;
> > >          PreparedStatement stmt = null;
> > >          try {
> > >              daoManager.startTransaction();
> > >              conn = getConnection();           
> > >              StringBuffer sql = new StringBuffer("INSERT INTO ");
> > >              sql.append(" PRL_PRODUCT_REQ (PRODUCT_REQ_ID, 
> > > DESCRIPTION, FILING_TYPES, PRODUCT_ID, ");
> > >              sql.append(" PRODUCT_REQ_CAT_ID, PRL_STATE_ID, 
> > > DATE_LAST_MODIFIED, USER_LAST_MODIFIED, ");
> > >              sql.append(" DATE_CREATED, USER_CREATED) ");
> > >              sql.append(" VALUES (?, EMPTY_CLOB(), ?, ?, 
> ?, ?, ?, ?, 
> > > ?, ?)");
> > >               stmt = conn.prepareStatement(sql.toString());  <-- 
> > > Fails
> > here
> > >  
> > >  com.ibatis.common.exception.NestedRuntimeException: 
> Error accessing 
> > > SimplePooledConnection.  Connection has been invalidated (probably
> > released
> > > back to the pool).
> > >      at
> > >
> > 
> com.ibatis.common.jdbc.SimpleDataSource$SimplePooledConnection.getVali
> > dConnection(SimpleDataSource.java:901)
> > >      at
> > >
> > 
> com.ibatis.common.jdbc.SimpleDataSource$SimplePooledConnection.invoke(
> > SimpleDataSource.java:946)
> > >      at $Proxy8.prepareStatement(Unknown Source)
> > >      at
> > >
> > 
> com.serff.prl.dao.impl.OracleJdbcProductRequirementDAO.insert(OracleJd
> > bcProductRequirementDAO.java:224)
> > >      at
> > >
> > 
> com.serff.prl.dao.impl.OracleJdbcProductRequirementDAO.saveOrUpdate(Or
> > acleJdbcProductRequirementDAO.java:154)
> > >      at 
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > >      at 
> sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> > >      at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> > >      at java.lang.reflect.Method.invoke(Unknown Source)
> > >      at 
> com.ibatis.dao.engine.impl.DaoProxy.invoke(DaoProxy.java:72)
> > >      at $Proxy6.saveOrUpdate(Unknown Source)
> > >      at
> > >
> > 
> com.serff.prl.dao.ProductRequirementTest.testProductRequirementCRUD(Pr
> > oductRequirementTest.java:176)
> > >      at 
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > >      at 
> sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> > >      at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> > >      at java.lang.reflect.Method.invoke(Unknown Source)
> > >      at junit.framework.TestCase.runTest(TestCase.java:154)
> > >      at junit.framework.TestCase.runBare(TestCase.java:127)
> > >      at junit.framework.TestResult$1.protect(TestResult.java:106)
> > >      at 
> junit.framework.TestResult.runProtected(TestResult.java:124)
> > >      at junit.framework.TestResult.run(TestResult.java:109)
> > >      at junit.framework.TestCase.run(TestCase.java:118)
> > >      at junit.framework.TestSuite.runTest(TestSuite.java:208)
> > >      at junit.framework.TestSuite.run(TestSuite.java:203)
> > >      at
> > >
> > 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(Remote
> > TestRunner.java:421)
> > >      at
> > >
> > 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestR
> > unner.java:305)
> > >      at
> > >
> > 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTest
> > Runner.java:186)
> > > 
> > >
> > 
> >
> 


Mime
View raw message