Hi Chris, thanks for the comments. I thought since we have singleton class and
creating a connection object there, we will be reusing the same connection
object for all database operations. May be my thinking is not correct. Do you
suggest I just create the DataSource object in the private
Best practice is to store the DataSource, not the connections in your
singelton class. Then get a connection, perform your queries, and close
the connection immediately. The pool will take care of managing the
connections including creating new ones when existing connections die
which
Thanks David for the inputs. I will do the same. This might fix my original
problem aslo, I will try.
-Original Message-
From: David Smith [mailto:[EMAIL PROTECTED]
Sent: Monday, July 24, 2006 5:00 PM
To: Tomcat Users List
Subject: Re: Tomcat fails to refresh connections when mySQL
Thanks Tim and Chris for the response. Sorry, it took a while for me to
respond. We are not storing connections in the session. We have a singleton
class called DBManager and in its private constructor we have JNDI lookup for
the datasource and create a connection object there.
Context init
Seetha,
To answer Tim's question, we are not explicitly closing connection
and statement objects as the context xml has these resource parameters.
removeAbandoned=true
removeAbandonedTimeout=60
logAbandoned=true
This probably means that you are leaking every single connection. :(
Seetha,
Are you getting the connection anew after restarting the server? It looks
like you have this case:
T0Connection x = Datasource.getConnection()
T1Do some stuff
T2Shutdown / restart MySQL
T3x.prepareStatement() or other stuff
... FAIL
The connection pool will
Are you getting the connection anew after restarting the server? It looks
like you have this case:
T0 Connection x = Datasource.getConnection()
T1 Do some stuff
T2 Shutdown / restart MySQL
T3 x.prepareStatement() or other stuff
... FAIL
The connection pool will only renew