Access violation

Ric Ho

Member
Hi,

I have a piece of code that works properly when executed by an EXE, but that causes an "access violation" when run in in DLL:

session := TOracleSession.Create(nil);
session.LogonUsername := 'ric';
session.LogonPassword := 'pwd';
// and so on...

// so far so good
session.LogOn;
// this line never reached

InitOCI returns a success status, OCIDLL has the correct value of oci.dll, and so on... I really cannot figure out what is going on.

Any idea?

Thanks,
Ric
 
What exactly is the error message of the AV, and in which module does it occur? Is the DLL called from a host application that also accesses Oracle?
 
"Access violation at address 016CF02D in module 'EmailServer.dll'. Read of address 00000000"

The host application is ArgoSoft, a mail server that is totally independant from Oracle. EmailServer.dll is my DLL that uses the TOracleSession.
 
Perhaps Session.LogOn raises an exception, and the exception handler causes this error? Or perhaps the exception is unhandled and propagates?
 
In the following code, the error code is 0.
I could verify that the exception is raised by LogOn.

OracleSession := TOracleSession.Create(nil);
OracleSession.BytesPerCharacter := bcAutoDetect;
OracleSession.LogonUsername := getConfigurationValue('ORACLE_USER');
OracleSession.LogonPassword := getConfigurationValue('ORACLE_PASS');
OracleSession.LogonDatabase := getConfigurationValue('ORACLE_SERVICE');

try
//oracleSession.ThreadSafe := false;
//InitOCI;
//ShowMessage(OCIDLL);
OracleSession.LogOn;
except
on e: EOracleError do
begin
ShowMessage(IntToStr(e.ErrorCode));
ShowMessage(oracleSession.ErrorMessage(e.ErrorCode));
end;
end;
 
So there is an EOracleError instead of an EAccessViolation? Can you display E.Message instead of OracleSession.ErrorMessage()?
 
Back
Top