[Sqlrelay-discussion] ping() in Java
Brought to you by:
mused
|
From: Maciej W. <mac...@co...> - 2005-11-23 08:05:14
|
Hi!
I have a simple web service written in java, that gets data from
database using SQLRelay. The problem is with ping command.
This is part of my code:
import com.firstworks.sqlrelay.SQLRConnection;
import com.firstworks.sqlrelay.SQLRCursor;
if (conn.ping()){
...do something...
}
The database I'm connecting to is backuped every night and swithed down
for a while and possibly this causes problem. Every morning I'm receiving
'false' from ping() command, but... when I'm trying to send query even
when ping
returns 'false' it executes correctly... I did something like this:
if (conn.ping()){
...do something...
}
else{
SQLRCursor cur=new SQLRCursor(conn);
cur.getNullsAsNulls();
String query = "SELECT * from table";
cur.sendQuery(query);
System.out.println("ping false. rowCount:"+cur.rowCount());
}
and rowCount() returns 1 for my select, so... connection works!
Strangely after doing this query and starting my program again ping
returns 'true'... till next morning.
I think it's possibly a bug with ping() in java code...?
--
Maciej Wisniowski
|