Re: how can i fix this DBPool???
From: Joe Weinstein (joeNOSPAM_at_bea.com)
Date: 10/01/04
- Previous message: Omar Vazquez: "Re: get the jdbc connecto for db2"
- In reply to: slzang: "how can i fix this DBPool???"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 01 Oct 2004 11:51:22 -0700 To: slzang <slzang@mailst.xjtu.edu.cn>
slzang wrote:
> hi all:
> I am using a dbpool written by myself,but recently i find there are
> some trouble to connect mysql server.
> Mysql server set wait_timeout=28800(default 8hours),so when the
> connections in dbpool do not be used in 8 hours, mysql server will
> disconnect it,then i got the exception message :communication link failure.
> I hate myself why i do not use j2ee datasoure at first.but there are
> so lot of works to be done if i change to j2ee datasoure, i really do
> not want to reconstruct it.
> In dbpool i try to use java.sql.connection.isClose() to detect
> whether a connection is valid, but i fail.
> So is there any ideas?
Hi. isClosed() only tells you if *you* have called close(), not if the connection
is still good. The only way to overcome a DBMS timeout is to make the pool run a
test query (select 1). If it succeeds, the connection is good. If it fails, close it and
make a replacement. DataSource won't help this issue at all.
Joe Weinstein at BEA
>
> Regards
> Shawn Lee zang
- Previous message: Omar Vazquez: "Re: get the jdbc connecto for db2"
- In reply to: slzang: "how can i fix this DBPool???"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|