You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-cs@ibatis.apache.org by Dorin Manoli <Do...@dataireland.ie> on 2006/10/25 10:26:44 UTC
Active connection
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.
RE: Active connection
Posted by Dorin Manoli <Do...@dataireland.ie>.
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://www.mail-archive.com/ibatis-user-java@incubator.apache.org/msg026
51.html
Larry
On 10/25/06, Dorin Manoli <Do...@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.
RE: Active connection
Posted by Anthony <an...@mevspc.com>.
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://www.mail-archive.com/ibatis-user-java@incubator.apache.org/msg026
51.html
Larry
On 10/25/06, Dorin Manoli <Do...@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.
Re: Active connection
Posted by Larry Meadors <lm...@apache.org>.
You'll need to use a ping query to make sure that the connection is valid.
Something like this:
http://www.mail-archive.com/ibatis-user-java@incubator.apache.org/msg02651.html
Larry
On 10/25/06, Dorin Manoli <Do...@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.