I am just testing the isClosed() method. In my opinion it is the driver's
responsibility to use the most efficient way to test if the connection is valid
or not.
Testing with a simple statement like "select * from dual" is certainly also an
option, but definitely less efficient. Because normally this means parsing an
sql string, executing it and so on, whereas the driver can use some proprietary
method to ask the server if a connection is still valid.
I tested the isClosed() method for the following drivers:
MySQL worked
PostgresSQL didn't work, but we patched it
InterClient 1.6 didn't work
--- Matthias
Johan Compagner wrote:
>
> Do you just test the isClosed() method?
> My plan was to execute a small sql code that has a very little overhead
> and alway's returns normal for every db if the connection is still good.
>
> But i don't know what kind of sql statement works for every db.
>
> johan
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
> > Matthias Bauer
> > Sent: Wednesday, March 07, 2001 4:02 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: Database pooling code
> >
> >
> > Database pooling works pretty well for me. But there are some
> > pitfalls, when a
> > connection times out or the database server is restarted. As the
> > framework does
> > not check if a connection is still valid before returning it to
> > the application
> > you will run into an exception when trying to use a connection
> > which has timed
> > out or was closed due to some other reason on the server side.
> >
> > I know there was some discussion going on about this on the list
> > in the past.
> > There were some pros and cons about whether the framework should check the
> > validity of a connection before returning it to the application.
> > I patched the
> > struts code in order to do this check and always return a valid connection
> > (requires the jdbc driver Connection.isClosed() method to work
> > correctly - some
> > have a bug in their implementation). If you are interested in
> > this little patch,
> > please let me know.
> >
> > --- Matthias
> >
> >
> > I patched
> >
> > Jim Richards wrote:
> > >
> > > Has anyone got the database pooling code/DataSource to work or
> > specifically
> > > had it fail?
> > >
> > > I've been having problems (documented previously) and I've read
> > about a few others
> > > who can't seem to get the pooling to work as well, and I want
> > to get an idea
> > > of specifically where the problem might lie in order to fix it.
> > >
> > > ----
> > > You are the simulacrum of my dreams
> > > and the signifier of my desires
> > >
> > > Mr Grumpy ... come and visit his home!
> > > http://www.cyber4.org/members/grumpy/index.html
> >