Page 1 of 1

Prevent ORA-03135 from occure

Posted: Tue 05 Sep 2006 08:27
by kurtbilde
Hi,

I do open all tables at my Datamoduls OnCreate-event (close them at Ondestroy-event). If the application is idle for a while, an ORA-03135 raises. This mean that the connection has been lost to the server. Is there a property that need to be set in order to prevent a disconnect or should there be a reconnect-procedure somewhere and how will it be like (code wise)?

-Kurt

Posted: Fri 08 Sep 2006 06:41
by Plash
To prevent error you can check connection before query execution. Connection check can be performed, for example, by calling Commit method of TOraSession. When connection is lost Commit method raises an exception.

If all datasets that use this session have FetchAll property set to True and there are no prepared datasets, ODAC will automatically reconnect to database when connection error occurs. Otherwise you can reconnect manually by calling Connect method of TOraSession.

Code: Select all

  try
    OraSession.Commit;
  except
    if not OraSession.Connected then
      OraSession.Connect;
  end;