Oracle Logon Prompt Error Message Adjustment

Hi this is a question about error handling (exception handling) for a login prompt.

Environment Description:

Borland C++ Builder 6.0 (Build 10.166)

Windows 2000 (SP4)

Direct Oracle Access 4.0.5.0

Oracle8i Enterprise Edition Release 8.1.7.4.0

The problem I am having is trying to catch the exceptions that are thrown by the statement frmMain->OracleLogonSessionMain->Execute().

I want to override the default messages that appear such as "ORA-01005: null password given; logon denied". I have tried placing a try-catch block around the line mentioned above to no avail (I suspect the exception is thrown and caught inside the Execute() function).

Any tips on how to handle this issue as well as design improvements to my logon loop-if structure would be greatly appreciated (right now I have it set up so that the user will have infinite logon attempts until they are successful or click 'Cancel' / 'X').

Thank you,

Christopher Kennedy

WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)

{

try

{

Application->Initialize();

Application->CreateForm(__classid(TfrmMain), &frmMain);

while (!frmMain->OracleSessionMain->Connected)

{

// TRY-CATCH BLOCK AROUND THE FOLLOWING LINE?????

// TOracleLogon->Execute() returns false if 'Cancel' or 'X' is pressed

bool cancel = !frmMain->OracleLogonSessionMain->Execute();

if (cancel)

{

return 0;

}

}

Application->Run();

}

catch (Exception &exception)

{

// HAS YET TO EXECUTE WITH ALL THE TEST CASES I HAVE RUN

Application->ShowException(&exception);

}

return 0;

}
 
There is no elegant way to catch these exceptions, but you can use the OnOracleError to translate specific errors or set a flag on specific errors. See the help file for an example.
 
The documentation provided for OnOracleError was written in Delphi.

Could you please provide a C++ statement equivalent to:

initialization
Oracle.OnOracleError := LogOracleError;

(Taken from the C++ builder help file under the topic OnOracleError).

I would really appreciate some example code of how to override error messages like you suggested.

Thank you,

Christopher.
 
Back
Top