Posted By: mclot Session checkconnection(true) - 07/18/14 07:30 AM
Hi everybody,

I'm a little bit confused about the behaviour of "reconnect" parameter in CheckConnection function of DOA session component.
I don't understand when the reconnecting may occur.
I test my application connection periodically via a timer. If I disconnect the network cable, I correctly get the ccError from the CheckConnection function call. But when I reconnect the network cable, the CheckConnection still returns ccError, even if I've forced the reconnection with the reconnect parameter.
In other posts Marco wrote that you need to have a valid session connection in order to get working the CheckConnection function, and that's why I'm confused ... If you need a valid session connection, I expect to get back always OK or error and I don't understand WHEN the reconnecting step may occur.
The help file doesn't help as it states that the reconnect parameter is useful to re-establish the lost connection and that's what I expected to get. Or maybe it works only under specific circumstances and/or only when the connected property of the TSession component still results true?
May someone explain this behaviour?

TIA and best regards
Massimo
Posted By: Marco Kalter Re: Session checkconnection(true) - 07/18/14 09:20 AM
For a reconnect to work you need a valid network connection and the Oracle Server must be available.

I tested your scenario, and it seems to work fine. The CheckConnection function first returns ccOK when the network cable is connected, when disconnected it returns ccError, and after reconnecting it first returns ccReconnected, and subsequent calls return ccOK again.

What you might try is to debug this scenario, so that you can see exactly which Oracle Errors occur when the cable is disconnected, and subsequently when it is reconnected.
Posted By: mclot Re: Session checkconnection(true) - 08/04/14 07:20 AM
First of all, really sorry for the delay in my feedback ...
You're right! debugging, I discover a tricky statement in a procedure of mine that was changing in a wrong way the username property of the TOracleSession and obviously I received the Oracle msg "Invalid username/password" error.
After the bug fix, the checkconnection worked perfectly.
Thanks a lot.
Massimo
© Allround Automations forums