Problem with exceptions

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for Oracle in Delphi and C++Builder
Post Reply
jsaumell
Posts: 9
Joined: Thu 05 Jun 2008 16:02

Problem with exceptions

Post by jsaumell » Thu 04 Dec 2008 16:24

We have problems catching an exception but perhaps i'm losing something, I'm newbie in Delphi development.

We are using "Oracle (Core Lab)" and "Delphi 2006".

The problem is in one of our customers; they have a firewall that "kills" all net connections after 10 minutes of inactivity. They ask us to look if we can handle this and reconect. Users left app open and when reestart to use an error ocurs, the firewal killed the net connection, the app crash and users have to reestart the app.

I thought to put a break point in delphi, kill the session in oracle, detect the error and reconnect to Oracle.

I have two problems:

1.- I can't trap the exception.
2.- My delphi didn't recognize the EOraError Exception.

I explain.

For the first point the code seems like this:

with Result do
try
SchemaName := strSchemeName;
StoredProcName := strStoredProcName; => Here we put the break point and kill the session
except
On e : Exception do => I try with EDataBaseError too
begin
raise Exception.Create(e.Message);
end;
end;

Result is TSQLStoredProc

The Oracle Error arrive to Delphi (EOraError with message 'ORA - 00028 your session has been killed'); but the exception doesn't fire, the code continues after try-except.

The second error perhaps is more stupid, if in this try-except block I put the EOraError Delphi doesn't recognize the word, I put the uses OraError and Delphi doesn't recognize too.

u need more info??


Thanks in advance.

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

Post by Plash » Fri 05 Dec 2008 11:43

EOraError is the internal driver exception. It is raised and then catched inside the driver. So there is nothing to catch for you.

dbExpress does not raise an exception for user when an error occurs on setting the StoredProcName property. It just does not create parameters for a stored procedure.
You can catch an exception on the ExecProc method if the session is killed before the call of this method.

reicesar
Posts: 3
Joined: Tue 19 Aug 2008 14:25

Re: Problem with exceptions

Post by reicesar » Tue 18 Jun 2013 13:58

Hi,

I have the same problem in C++ Builder XE2.
The component dbExpress driver for Oracle 6.1.2 reconnect automatically after receive 'ORA-00028 your session has been killed'.
I need to catch that error to decide to terminate my application or not. How can I do it?

Thank you,
Reinaldo Guedes
Brazil

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Problem with exceptions

Post by AlexP » Tue 25 Jun 2013 09:01

Hello,

To disable auto-reconnecting to the server, you should set the Reconnect parameter to False

SQLConnection1.Params.Values['Reconnect'] := 'False';

Post Reply