I use 6.0.29, and there was a setting I had to change to keep some connections 
from hanging or timing out.

Although I use Tomcat's DBCP, and not OracleDataSource.

I think it was this first line here.

     timeBetweenEvictionRunsMillis="-1"
    minEvictableIdleTimeMillis="28800"
    poolPreparedStatements="true"
    removeAbandoned="true"
    removeAbandonedTimeout="300"
    logAbandoned="false

If you can go back to DBCP, check that...and why did you need to cast to 
Oracle's connection?

-----Original Message-----
From: Daniel Mikusa [mailto:dmik...@vmware.com]
Sent: Wednesday, November 21, 2012 9:11 AM
To: Tomcat Users List
Subject: Re: DB Connection Pool

On Nov 21, 2012, at 9:45 AM, Milan Tomic wrote:

>
>
>> That's a really old version, you should strongly consider upgrading to the 
>> latest Tomcat 6.0.x or 7.0.x release.
> My SSO (old JOSSO version) works only with 6.0.18.
>
>> How are you determining this? Are you looking at open connections from your 
>> database?  Are you looking at JMX stats for the connection pool?
> I'm using JavaMelody monitoring system.

Can you verify this through your database?  Perhaps the monitoring tool is not 
showing the correct information?

>
>> These don't really seem to be indicating any sort of problem.  The first 
>> looks like it is reading data from a socket, the second is simply waiting 
>> for something to do.
> Yes, but why there are 50 open old (some almost a month) DB connections (and 
> still raising) on low traffic app?

This sounds like an application issue.  Check to make sure it is not storing 
connections retrieved from the connection pool and check to make sure that you 
are properly closing connection (i.e. correctly using try..catch..finally).

If possible, maybe run FindBugs.  That's a good way to catch errors like these.

> That is strange. There should be some parameter to auto close old 
> connections. I have tried tunning many parameters, but without success.

Can't really say with OracleDataSource.  With DBCP there is "removeAbandoned" / 
"removeAbandonedTimeout" / "logAbandoned" which can be used to reclaim 
connections that have been held by the application for too long.

>
>> This looks fairly normal with the exception that you are using an 
>> OracleDataSource.  Not sure how much this list will be able to help you if 
>> the problem is with the connection pool.  You'd probably need to contact 
>> Oracle.
> I was using DBCP, but I couldn't cast in my Java servlet code from DBCP to 
> OracleConnection once when I get DBCP datasource from JNDI 
> (getInnerConnection() also didn't helped), so I swithced from DBCP to 
> OracleDataSource.

The documentation for DBCP say to do this...

1.) Set  "accessToUnderlyingConnectionAllowed" to "true" (it defaults to false)

2.) Use this construct to get the connection.  Do NOT close the underlying 
connection, only the original one!

    Connection conn = ds.getConnection();
    Connection dconn = ((DelegatingConnection) conn).getInnermostDelegate();
    ...
    conn.close()

https://commons.apache.org/dbcp/configuration.html

I have not done this though, so I cannot be sure it will work for you.

Dan




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to