ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tracey Annison" <tanni...@trisystems.co.uk>
Subject RE: Spring, Ibatis, and DBCP commons pooling
Date Mon, 17 Sep 2007 07:35:55 GMT
Hiya, Jeff

Yes, it is Tomcat we're using.

Ah... we thought that was handled by the context.xml setup that we'd
done, with the testOnBorrow property & query? In my ignorance, I figured
that if TestOnBorrow failed, it'd go and try again, and make another
connection that would work. Is there something else I should be looking
at?
 
Mind you, the logs (relevant bit below) kind of imply that this IS
what's happening, and that the failure is happening when the bad
connection is detected and "returned"... don't they?
11:51:05,537
org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection():11
1 - Fetching JDBC Connection from DataSource
11:51:05,537
com.ibatis.common.logging.jakarta.JakartaCommonsLoggingImpl.debug():23
-{conn-100064} Connection
11:51:05,553
org.springframework.jdbc.datasource.DataSourceUtils.doReleaseConnection(
):285 - Returning JDBC Connection to DataSource
11:51:05,615 uk.co.XXX.our.dao.OurIbatisDAO.isItemExtant():538 - Ibatis
DAO Exception java.sql.SQLException: Already closed. 
at
org.apache.tomcat.dbcp.dbcp.PoolableConnection.close(PoolableConnection.
java:77)
at
org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper
.close(PoolingDataSource.java:180)
at
org.springframework.jdbc.datasource.DataSourceUtils.doReleaseConnection(
DataSourceUtils.java:286)
at
org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy$Tran
sactionAwareInvocationHandler.invoke(TransactionAwareDataSourceProxy.jav
a:161)
at $Proxy52.close(Unknown Source)


Cheers 
Tracey Annison 

 

  _____  

From: Jeff Butler [mailto:jeffgbutler@gmail.com] 
Sent: 14 September 2007 12:07
To: user-java@ibatis.apache.org
Subject: Re: Spring, Ibatis, and DBCP commons pooling


If you're using JNDI datasources, then it's likely that you'll need to
configure ping queries in the container that's managing the connection
pool.
 
What's the container?  I'm guessing you're using Tomcat, but it's not
clear.
 
Jeff Butler

 
On 9/14/07, Tracey Annison <tannison@trisystems.co.uk> wrote: 

Heya

Hmmm, yes... But isn't that functionally the same as what we have here
in our context.xml :

       <Resource name="jdbc/imacs"
                 auth="Container"
                     type="javax.sql.DataSource"
                 driverClassName="XXX"
                 url="XXX"
                 username="XXX"
                 password="XXX" />

       <ResourceParams name="jdbc/imacs">
               <parameter> 
                       <name>factory</name>
                       <value>

org.apache.commons.dbcp.BasicDataSourceFactory
                       </value>
               </parameter> 
               <parameter>
                       <name>maxActive</name>
                       <value>10</value>
               </parameter>
               <parameter> 
                       <name>maxIdle</name>
                       <value>2</value>
               </parameter>
               <parameter>
                       <name>maxWait</name> 
                       <value>100</value>
               </parameter>
               <parameter>
                       <name>testOnBorrow</name>
                       <value>true</value> 
               </parameter>
               <parameter>
                       <name>validationQuery</name>
                       <value>select 1</value>
               </parameter> 
       </ResourceParams>

Which is giving the bad results that we see...

Cheers
Tracey Annison

-----Original Message-----
From: charlie bird [mailto: zebthecat@yahoo.co.uk
<mailto:zebthecat@yahoo.co.uk> ]
Sent: 13 September 2007 16:57
To: user-java@ibatis.apache.org
Subject: RE: Spring, Ibatis, and DBCP commons pooling

Don't know if this'll help but we always put the dbcp config in the 
Apache application context xml and NOT in the app's Resouce config.

I think that the properties you're looking for are:
testOnBorrow
testOnReturn
testWhileIdle
validationQuery

See here for more info: 
http://commons.apache.org/dbcp/configuration.html

Something like this maybe:

<Resource name="jdbc/creditSubscriptions"
auth="Container" type=" javax.sql.DataSource"
              maxActive="100" maxIdle="30"
maxWait="10000" username="sa" password="password"
driverClassName="class"
removeAbandoned="true" removeAbandonedTimeout="60" 
logAbandoned="true"
url="jdbc:somurl"
validationQuery="select 'hello'"
testOnBorrow="true"
testOnReturn="true"
testWhileIdle="true"
/>




--- Tracey Annison <tannison@trisystems.co.uk> wrote:

> But this is a setup for a SimpleDataSource, with Ibatis pooling, and
> not using the apache commons DBCP pooling at all, isn't it? 
>
> You see, we had it set up like this, with settings that we thought
> were a hangover from before the apace commons poling was enabled, and
> we saw exactly the same problems... it seemed to us that having pool 
> settings here, and in the context.xml for apache, was a mistake... ?
>
> Cheers
> Tracey Annison
>
>
>
>   _____






----------------------------------------------------------------------
The information in this email is confidential and may be legally privileged. 
It is intended solely for the addressee. Access to this email by 
anyone else is unauthorised. If you are not the intended recipient, 
any disclosure, copying, distribution, or any action taken or omitted 
to be taken in reliance on it, is prohibited and may be unlawful. 
TriSystems Ltd. cannot accept liability for statements made which are clearly
the sender's own.


Mime
View raw message