Re: [Sqlrelay-discussion] ping() in Java
Brought to you by:
mused
|
From: David M. <dav...@fi...> - 2005-12-16 15:17:28
|
Hey Maciej,
If SQL Relay lost contact with the database during the backup and no
other queries had been run, then I'd expect the ping to return false,
and then the next query to cause SQL Relay to reconnect, run the query
and return rowcount of 1.
If you have 3 sqlr-connection daemons running, you'd see that behavior 3
times. After all 3 sqlr-connections have re-established their database
conections, ping should start returning true.
The behavior your java program exhibits is exactly what I'd expect.
If the python program exhibits different behavior, then maybe there's a
bug there. Although ping is implemented identically for both API's.
They just wrap the C++ function.
Does the python program maybe run against a different database, where
another program may have run queries against the database since the
backup?
Just to be sure, I'll see if I can simulate the same conditions here and
let you know what I find out.
Dave
dav...@fi...
[snip]
> 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
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
> for problems? Stop! Download the new AJAX search engine that makes
> searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
> _______________________________________________
> Sqlrelay-discussion mailing list
> Sql...@li...
> https://lists.sourceforge.net/lists/listinfo/sqlrelay-discussion
>
|