Page 1 of 1

Disconnect detection

Posted: Mon 18 Feb 2013 23:32
by wjm4
What is the best way to detect when an oracle connection is disconnected and reconnect? I have the following scenario:
1) connect to database with direct option
2) preform query and get results
3) connection is lost to the server
4) preform another query that is unsuccessful. However, when I check the connected property of the connection before running, it says true. I have also tried to put code in the onsessionerror method but that does not get called every time the query->execute gets called.

What is the best way to deal with a connection that can go down?

Re: Disconnect detection

Posted: Thu 21 Feb 2013 09:47
by AlexP
Hello,

You can use the TOraSession.onConnectionLost event and set the RetryMode parameter in it to the rmReconnectExecute value. In this case, when attempting to execute the query, if connection is lost, there will be an attempt to reconnect and execute the query. To use this event, you should add the MemData module to the uses section and set the TOraSession.Options.LocalFailover property to True.