Prevent ORA-03135 from occure

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
kurtbilde
Posts: 114
Joined: Wed 16 Mar 2005 16:02
Location: Odense, Denmark

Prevent ORA-03135 from occure

Post by kurtbilde » Tue 05 Sep 2006 08:27

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

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Fri 08 Sep 2006 06:41

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;

Post Reply