[Opensource] connection pool problems with database offline

Mike Traum mtraum at jgroup.net
Wed May 5 11:02:06 PDT 2004


Mathew,
Are you using Expresso's connection pool or the application server's? 

If you are using expresso's, what version of expresso are you running?
What database? Does this occur with DBObject's, or only when you
manually retrieve the database connection? I have not been able to
reproduce your problem.

thanks,
mike


On Tue, 2004-05-04 at 05:22, Suresh.M, ISDC Chennai wrote:
> Hi all..
>  This is in response to the connection pooling problem mail(to be more
> clear even after database server restart the application fails to get
> a connection if the application server is not restarted)
> 
> Solution which I found successfull is...
> 
>    The scenario is that:
>     The database server is not reporting to the application server
> when ever its restarted(Actually its required to restart the
> application server whenever you restart the database server)..So the
> connection pool handler in our case the datasource, is not aware of
> the fact that the connections inside the pool it is having is stale
> and needs to be re initialised.And since the implementation of the
> connection pool is using a stack ,if we return the bad connection it
> will put it over the top of the stack and will return the same stale
> connection all the time and it will end up waiting until the
> connection time out.
> 
> To get out of this problem we kept the bad connections with us and
> forcefully requested for a new connection until we got a good
> connection (using datasource.getConnection()) and when we get a good
> connection (identified as good connection by running a test query
> using the connection and checking for a non empty resultset before
> using it)we will give the bad connections back to the stack(using
> connection.close()) and the application server by itself will
> reinitialise the connection..
> 
> To summarize
>   previously we were asking for a connection and using it straight
> away(thats the normal practice).
>   now we are asking for the connections and keeping the connection in
> an array until we get a good connection 
>   and will return the bad connections to the connection pool stack for
> the application server to refresh the connection.
> 
> The algorithm for the function which fetches the connection from the
> pool.
> 
> while(badconnection){
>    Get a Connection from the pool.
>    Check for good connection by running a test query
>    If its a good connection       
>       return the connection for use       
>    end if
>    else
>      keep the connection with us in an array.
>      get a new connection
>    end else 
>  }
> 
> 
> 
> 
> 
> Thanks & Regards,
> 
> Mathew Suresh.
> Associate Software Engineer,
> I.S.D.C,
> HCL Technology Solutions Ltd.,
> 34 & 35 Haddows Road,
> Nungambakkom,
> Chennai 600 034,India.
> Phone:52159999
> Extn:1512
> 
> 
> Disclaimer:
> This document is intended for transmission to the named recipient
> only. If you are not that person you should note that legal rights
> reside in this document and you are not authorized to access read
> disclose copy use or otherwise deal with it and any such actions are
> prohibited and may be unlawful. The views expressed in this document
> are not necessarily those of HCL Technologies Ltd. Notice is hereby
> given that no representation contract or other binding obligation
> shall be created by this e-mail which must be interpreted accordingly.
> Any representations contractual rights or obligations shall be
> separately communicated in writing and signed in the original by a
> duly authorized officer of the relevant company.
> 
> 
> 
> 
> 
> 
> ______________________________________________________________________
> _______________________________________________
> Opensource mailing list
> Opensource at jcorporate.com
> http://mailman.jcorporate.com/mailman/listinfo/opensource
-- 

Mike Traum
--
JGroup Expert 
Expresso Core Developer 
Providing support and development services - Available Now!



More information about the Opensource mailing list