Re: [Sqlrelay-discussion] ping() in Java
Brought to you by:
mused
|
From: Maciej W. <mac...@co...> - 2005-12-09 08:57:44
|
Hi!
> This is intentional, the idea is that if the network hiccups or a
> load-balanced database server goes down, the SQL Relay server will
> recover and, aside from a pause, it will appear as if nothing happened
> to the clients.
I understand it, but I think my problem is different. Or maybe I'm wrong?
My program runs as follows:
import com.firstworks.sqlrelay.SQLRConnection;
import com.firstworks.sqlrelay.SQLRCursor;
//loop three times
for (int a=0; a<=3; a++){
SQLRConnection conn = new SQLRConnection(host, port, socket, user, pwd, 0, 1);
System.out.println("ping"+conn.ping()+". ");
if (conn.ping()){
System.out.println("OK");
}
else{
SQLRCursor cur=new SQLRCursor(conn);
cur.getNullsAsNulls();
String query = "select xxx from xyz";
cur.sendQuery(query);
System.out.println("rowcount:"+cur.rowCount());
}
}
Today morning (after database backup at night) I've started my program
and the result was:
ping false. rowcount:1
ping false. rowcount:1
ping false. rowcount:1
Then I've started this program again and the result was:
ping true. OK
ping true. OK
ping true. OK
It seems that SQLRelay is connected to database because sendQuery
returns some results but ping returns false (bug?).
When whole program is executed for the second time (but not in the
second loop run) everything starts to work correctly.
As far as I've checked this, in python there are no such problems, and
ping returns true even in the first run.
---
Maciej Wisniowski
|