I also had to solve this problem for one of our applications. I changed
GenericDataSource.java, so I am checking the isClosed method of a connection
before I am returning it to the caller of getConnection().

I know, that there is a statement in the Java Specification which says that the
isClosed() method does not need to return the current server state. It just
needs to report whether the close() method has been called before. This is
really unfortunate. But at least the MySQL driver and the PostgesSQL driver
(with a little patch) I am using return the proper server state. So I get along
with my struts patch for these drivers. You will just have to try out if it also
works in your case.

I have included the modified GenericDataSource.java. Try it out and please let
me know whether it works for you.

--- Matthias



Vivek Bhaskaran wrote:
> 
> Hi People....
>     I was looking through the implementation of the javax.sql.DataSource
> (inside the org.apache.struts.util) package. One think I am facing with that
> mysql disconnects after a specified period of timeout. So the DB Pool gets
> corrupted.
> 
> I was about to go ahead and add some code to the GenericDataSource to check
> for the conneciton before giving it to a consumer.
> 
> Now my question is has this already been done? I did take a look at the
> WebCVS and could not find anything to that repect.... Is this something that
> needs to be done ?
> 
> -vivek

GenericDataSource.java

S/MIME Cryptographic Signature

Reply via email to