This is not working. Maybe I'm doing something wrong, but I have a simple sample app that demonstrates the problem that I can send. I'll explain is in detail here.
I have a TOraSession and a TSmartQuery on a form. Both objects have default property values set except for TOraSession which has Options.LocalFailover set to True. I have implemented an OnConnectionLost event handler for the TOraSession which sets RetryMode to rmRaise.
I have one button on the form to connect the TOraSession.
I have another button on the form that executes the TSmartQuery which has the SQL.Text set to...
Code: Select all
SELECT COUNT(*) obj_count FROM user_objects
After successful execution I show a message that displays the value of obj_count.
Executing the sample app I do the following... click Connect (session is connected), click Execute (query is executed and obj_count is displayed), load a utility like SQLPlus, Toad, etc. and kill the session that was created to simulate a lost session. Similarly this could have been done with a profile that terminates the session after inactivity or by pulling the network cable on the PC to simulate a network issue. Now, if I click Execute again I get an "ORA-03113 - End of file communication channel" error which is expected. I click Execute again and the session is reconnected. I have placed a breakpoint in my OnConnectionLost handler and it is getting called and RetryMode is being set to rmRaise.
I then tried the following... I modified TCustomDAConnection.DoError in DBAccess.pas so that Reconnect and Reexceute were both set to False so that reconnect should not happen regardless of the value of RetryMode in my OnConnectionLost handler. This did not work either as you would expect since the setting of RetryMode to rmRaise did not work above.
It seems that the query is ensuring a connection before it executes. This is a security vulnerability for us. If a user of our product leaves their workstation and the session has been disconnected then it is not in our best interest to allow someone else to come by and use the tool and have disconnected sessions reconnect without asking for login credentials. Ideally the user should ensure that their workstations are properly locked down, but with government agencies, banking institutions, and other customers that have tight security policies in place it is such that we should not allow a reconnect to occur. We want the user to manually reconnect by supplying the password again. Subsequent execution attempts against a disconnected session should continually raise an exception and the user should be required to use our login window to reconnect it.
Edit:
I should also add that you noted if the event doesn't fire then a reconnect will not occur, but this is not the case. When I place a breakpoint in my OnConnectionLost event handler I get to the breakpoint once. Just after my ORA-03113 error. When I click Execute again and the session is reconnected it never stops on the breakpoint. In this case the event handler was not called and the session was reconnected.
I hope that I have explained the problem well.
I can send a sample app if you'd like.
Any ideas?
Thanks,
Michael