Atomikos Forum

AtomikosDataSourceBean:testOnBorrow for transactional datasource

We've setup an xa datasource using Transaction-Essentials (3.5.8) under tomcat 5.5x. Everything works great.

But, they are putting a firewall betwen our app and the db, and the firewall automatically disconnects idle connections after a pre-configured amount of time.

Any way to to configure the AtomikosDataSourceBean to test each connection on borrow so the app doesn't get dead connections closed by the firewall. I see there's a "testOnBorrow" attribute on NonXADataSourceBean, but not AtomikosDataSourceBean.

For completeness, here's the tomcat datasouce configuration:


    <Resource name="pfmPool"
            auth="Container" type="com.atomikos.jdbc.AtomikosDataSourceBean"   
            factory="com.atomikos.tomcat.BeanFactory"     
            uniqueResourceName="myPool" 
            xaDataSourceClassName="oracle.jdbc.xa.client.OracleXADataSource"
            xaProperties.URL="jdbc:oracle:thin:@10.160.43.46:1561:DBSID"
            maxPoolSize="40"
            minPoolSize="5"
            borrowConnectionTimeout="30"
    testQuery="select 1 from dual"
            xaProperties.user="the_user"
            xaProperties.password="the_pass"/>
           


Thanks in advance.
jack donohue Send private email
Wednesday, February 16, 2011
 
 
Try testQuery :-)
Guy Pardon Send private email
Friday, February 18, 2011
 
 
Thanks for the reply. Yes, testQuery is already in the config (posted above).

I was looking for a way to configure the connection pool so that it would test each connection *before* it is handed to the application code. As mentioned above, connections in the pool are being disconnected by the firewall after a period of inactivity, so the connection pool is handing the application a dead connection.

For now we've set the pool maxIdleTime to 30 seconds and minPoolSize to 0. Obviously this isn't optimal, but it gives us a better chance of not getting a connection from the pool that's already been closed by the firewall.
jack donohue Send private email
Friday, February 18, 2011
 
 
testQuery should do what you want - did you check with the latest build?
Guy Pardon Send private email
Friday, February 18, 2011
 
 
Yes, you're right. In my local dev environment I put a breakpoint in testUnderlyingConnection and it is indeed running the test query.

So there's some other issue.

Thanks for pointing this out (twice).
jack donohue Send private email
Friday, February 18, 2011
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics