I found a way. To use LocalSession.State
-----Original Message-----
From: Anthony [mailto:anthony mevspc.com]
Sent: Thursday, October 26, 2006 3:58 AM
To: user-cs ibatis.apache.org; lmeadors apache.org
Subject: RE: Active connection
That ping query, specifically the "DUAL" part, is
strictly for Oracle
only
Use an SQL92 standard query. This will work on Oracle,
MS-SQL, and newer
versions of MySQL as well. Of course if you have hundreds of
tables,
this query will lose performance. In that case you may need
to derive a
more efficient simple query.
SELECT COUNT(1) FROM INFORMATION_SCHEMA.TABLES
But I think the original post will not even get that far. He
has lost DB
connection, so he definitely will not be able to run a query
and an
exception will be thrown. I am too new to iBatis, but if
there isn't
one, there should be a ConnectionState property to determine
state of
the connection.
-----Original Message-----
From: larry.meadors gmail.com [mailto:larry.meadors gmail.com] On Behalf
Of Larry Meadors
Sent: Wednesday, October 25, 2006 7:25 AM
To: user-cs ibatis.apache.org
Subject: Re: Active connection
You'll need to use a ping query to make sure that the
connection is
valid.
Something like this:
http://w
ww.mail-archive.com/ibatis-user-java incubator.apache.org/msg026
51.html
Larry
On 10/25/06, Dorin Manoli <Dorin.Manoli dataireland.ie> wrote:
>
>
>
>
> Hi ALL! I'm wondering if is there any way to see if a
connection is
active
> or not (didn't found in docs), because I got exceptions
when I loose
DB
> connection and have to reconnect.
>
> Need a nice way to do that, not catching exceptions.
|