Access violation in TOracleSession->LogOn()

keith

Member²
I have a very simple C++ application with 2 buttons and one TOracleSession.

Here is the buttons event handlers:

//----------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
OracleSession1->LogonUsername = "SYSDBA";
OracleSession1->LogonPassword = "nwbSG0101";
OracleSession1->LogonDatabase = "FAMS";
try
{
OracleSession1->LogOn();
}
catch(Exception &E)
{
ShowMessage("Didn't connect: "+E.Message);
}
}
//-------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
OracleSession1->LogOff();
}
//--------------------------------------------------------

The values are incorrect for the database, and I'd expect to see an exception action.

While the exception is thrown (the IDE is reporting "Project OraConnect.exe raised exception class EOracleError with message 'ORA-12154: TNS: could not resolve the connect identifier specified.',

the catch(Exception &E) is never reached. Instead, when Continue button is pressed, the IDE reports

Project OraConnect.exe raised exception class $C0000005 ACCESS VIOLATION

There is very little code in this project, which could create an access violation.

Clicking the logoff button exhibits no such violation.

This is target platform 64-bit Windows.

I have 64-bit Oracle installed, hence cannot build with the 32-bit Windows platform (tried, and received message Data :01F8D4EC L"Initialization error\r\nCould not initialize \"C:\\oraclexe\\app\\oracle\\product\\11.2.0\\server\\bin\\oci.dll\"\r\nMake sure you have the 32 bits Oracle Client installed.\r\n\r\nOracleHomeKey: \r\nOracleHomeDir: C:\\oraclexe\\app\\oracle\\product\\11.2.0\\server\r\nFound: oci.dll\r\nUsing: C:\\oraclexe\\app\\oracle\\product\\11.2.0\\server\\bin\\oci.dll\r\nLoadLibrary(C:\\oraclexe\\app\\oracle\\product\\11.2.0\\server\\bin\\oci.dll) returned 0")
 
Hi Marco,

Please allow me to back up one moment...

I must test the operation in the following situations:
1) Oracle NOT installed, 32-bit application.
2) Oracle NOT installed, 64-bit application.
3) 64-bit application, Oracle 32-bit client installed.
4) 64-bit application, Oracle 64-bit client installed.

In 1), above, all functions correctly, exception is
"Initialization error
Oracle Client not properly installed
OracleHomeKey:
OracleHomeDir:"

catch block is entered, and E.Message is shown. No problem.

In 2), above, access violation, after exception, but the catch block is never entered.

I'll return to 3) and 4) after new clients are installed.

Thanks for responding.
 
Last edited:
Hi Marco,

With both database and client installed, and with valid connection (no exception thrown), the connection proceeds correctly, and a TOracleQuery properly and successfully completes a SQL select.

Only when the EOracleError exception is thrown does the access violation occur, only on 64-bit compilation.

32-bit compilation operates correctly throughout.

Now, to answer your question as to which client is being used... I don't know. I have both clients installed. I 'think' it's a network connection back to the local database, and I don't really know which client is being used.

Maybe you can instruct me in a means to either determine which is in effect, or, otherwise, enable only one of the two, and disable the other, and then test the 'other' way.

Thanks for your review and consideration.
 
I now only have 64-bit client installed, database is 64-bit, and is 11.2.0.2.

If I use a valid logon, there is no problem whatsoever.

If I use an invalid username, password, etc, any error causes access violation.

I am using Seattle 10 update 1 (10.1), 64-bit target platform.

I don't own the source code, hence cannot step the code.

Please tell me what I can do to find out why the address exception when the logon exception is thrown.
 
Well, Marco, I... uh em... reinstalled Seattle 10 update 1, your component, and the only other 3rd party component I use, and there is no longer any exception access violation.

I really hate to see this kind of thing, but, given ... the development system at hand, it is to be, I guess, occasionally 'expected' to happen.

Thanks for looking into this 'non-problem', and I apologize for wasting any time you have expended in looking into this.
 
Well, Marco,

This seems to not be final.

I installed Oracle 11.2.0.2 64-bit, the version at client site.

I again obtain access violation when any of userid/password/database is invalid; The exception event handler never receives control.

This time, I traced the instructions, as follows:

Call Oracle::TOracleSession::AreStatementsCached+0x0
..
..
Call Oracle::TOracleSession::ServerAttach()+0x0
..
..
424329 Call Oracle::TOracleSession::OCICall(int)+0x0
..
..
42437B Call Oracle::TOracleSession::OCICall(int)+0x0
..
..
Call Oracle::TOracleSession::ReturnCode()+0x0
..
..
Call Oracle::TOracleSession::RestoreCursor()+0x0
..
..
424666 Call Oracle::TOracleSession::ReturnCode()+0x0
..
..
42467A Call Oracle::TOracleSession::ReturnCode()+0x0
..
..
424712 Call Oracle::TOracleSession::ReturnCode()+0x0
..
..
424722 Call Oracle::TOracleSession::ErrorHandle()+0x0
..
..
424737 call _ZN6Oracle16RaiseOracleErrorEPNS_14TOracleSessionEiPN6System7TObjectE|283 + 0x0
..
..
417777 call Oracle::EOracleError::EOracleError(Oracle::TOracleSession*, int, System::TObject*) + 0x0
..
..
(clear message buffer, a 500 iteration loop)
4164C3 mov ecx,$000001f4
4164C9 rep movsq
4164CC movsb
4164CD cmp qword ptr [rbp+$00001040],$00
..
..
416560 call Oracle::TOracleSession::Release(bool) + 0x0
..
..
Message in buffer is: ORA-01017: invalid username/password; logon denied
..
..
416615 jmp Oracle::EOracleError::EOracleError(Oracle::TOracleSession*, int, System::TObject*) + 0x204

41777F call Oraclefilter::initialization() + 0x300

6EA357 call $6ea220

then some branch table

into an area with no labels...probably lib functions... then crash

This shows that the violation occurred after the actual message was taken from oracle (Message in buffer is: ORA-01017: invalid username/password; logon denied)

This appears to be in a 500-byte buffer that is cleared just before the message is retrieved.

I don't know if there is an interface difference or not between 11.2.0.1

I can provide my executable/project/map/object if you would like to look at what I am seeing.

In any event, the above should give a pretty good idea where in the code this is happening.

 
Hi Marco,

I also tested this on XE7, C++, with same result.

Has anything been found out on this?

I am ready to release my application, and this is the only part that fails... an invalid logon exception.

Again, I can provide my executable/map/objects/project files, if that would assist.

Thanking you in advance
 
Last edited:
The delphi Seattle 10 Update 1 works correctly, no access violation exception.

Can we please get on with this?
 
This address exception appears to be dependent
Project | Options | Packages | Runtime Packages -> Link with runtime packages is checked or not.

When not checked (shows 'False'), the catch exception handler around Session->LogOn() is given control.

When checked (shows 'True'), the catch exception handler never receives control, and instead, c0000000005 ACCESS_VIOLATION results, and only Break | Run | Program Reset will restore. This appears in the project xml true, in the
section.

Any false in the
section appears to be overridden by the later section setting (as expected.)

 
Similar error in DOA x64 from Embarcadero c++ 10.1(upd2).
In TOracleQuery.Execute and TOracleDataSet.ExecSql (with or without parameters) the function does not return an Exception if the query cannot be executed.
Debugger on x64 gives "ACCESS_VIOLATION 0000005" and the looping.
The same on the x32 give the correct Exception that you can handle.
In the DOA version 4.1.3.5 (Tokyo) compared to version 4.1.3 (Berlin) bit fixed
 
continued:
In the debugger issued the original Exception from Oracle, and then looping. In 4.1.3, the original Exception is not thrown, and immediately looping.
Simple test:
q->SQL->Clear();
q->SQL->Add("...");
try { q->Execute(); }catch(...) {...}
Installation Link with runtime packages=false helps for exe.
In the package there is no such option. Helps transfer all of bpi requires as .a to the project ( i.e., statically)
Developers DOA ???
 
Also had a problem with Win10 last on App 64bit and Delphi XE 10.2.3, this error only occurs for ".dll" (Excel), for ".exe" is executed without A/V, corrected by increasing the size of buffers when calling OCI methods . If you have the source code, see the similar calling FireDac methods.
Sorry for bad english, I used a translator.
 
Last edited:
Back
Top