Page 1 of 1
there is still a connection
Posted: Wed 28 Nov 2012 05:23
by sinys
when I don`t use the programm for a long time the session on server is broken and when I`m trying to access the session it could call the event like "TDataModule1.OraSes1ConnectionLost".
I need to close the programm and for closing it I do this:
OraSes1.Rollback;
OraSes1.Disconnect;
Sometimes these calles TDataModule1.OraSes1ConnectionLost and as a consequence the reconnection. Reconnection takes lots of time.
Is any quick way to find out about the session activity and avoid the reconnection in closing of session?
Re: there is still a connection
Posted: Wed 28 Nov 2012 12:15
by AlexP
Hello,
To check the current session, you can use the TOraSession.Ping method, having wrapped it into a Try...Except block, and, in case if execution of this method raises an error, execute the needed code in the except block. This method won't call the OnConnectionLost event independently on connection settings.
Re: there is still a connection
Posted: Wed 28 Nov 2012 16:02
by sinys
Method "Ping" the fastest?
Re: there is still a connection
Posted: Thu 29 Nov 2012 08:49
by AlexP
Hello,
Yes, it is the easiest way to define server availability and avoid the OnConnectionLost event
Re: there is still a connection
Posted: Thu 29 Nov 2012 15:42
by sinys
If user doesn`t use the program for a long time, he will get the message from the server that the connection is lost.
We get out from this situation using a timer and every minute send select * from dual to the session on the server didn`t close and still has been up to date.
May be a command Ping will do the same, but would it be faster and less overload the server?
Re: there is still a connection
Posted: Fri 30 Nov 2012 10:04
by AlexP
Hello,
Independently on how you execute the query (Open or Execute), server generates and returns ResultSet even for a query "SELECT * FROM DUAL", that requires definite time, the Ping command doesn't return ResultSet, therefore it is executed faster.
Re: there is still a connection
Posted: Fri 30 Nov 2012 13:50
by sinys
Would the ping command keep the session in active state on the server?
Re: there is still a connection
Posted: Mon 03 Dec 2012 15:36
by AlexP
Hello,
Yes, running the Ping command keeps the session in active.