Creating a 64-bit ISAPI dll; Session.Logon keeps returning an empty exception and doesn't connect

Hi there,

I am trying to create an ISAPI dll to run on a fully 64-bit machine, IIS 7 64-bit and Oracle 64-bit client.

The dll it self works fine, loads nicely in the browser etc..

There are several calls available and every call create a session, tries to connect and do some small database stuff.

The Logon of the session keeps returning an empty OracleExecption.
My code looks something like this:

Code:
dtmSession:=TdtmSession.Create(nil);
dtmSession.OracleSession.LogonDatabase:=OracleDatabase;
dtmSession.OracleSession.LogonUsername:=OracleSchema;
dtmSession.OracleSession.LogonPassword:=OracleWachtWoord
try
  try dtmSession.OracleSession.LogOn(errorMessage);
  except
    on E: Exception do
      LogIt(E.Message); //Returns Not Logged On
  end;
finally
   //Save a record to db
  FreeAndNil(dtmSession);
end;

I added some extra code to the LogOn procedure to return the real error message giving by Oracle but this is empty.

I am using XE6 with DOA 4.1.3.5

Any help is appreciated.
 
A small addition, i debugged the Oracle.pas en found out that the error occured on the code below.

Code:
if IsolationLevel <> ilUnchanged then
begin
  NewIsolationLevel := IsolationLevel;
  FIsolationLevel   := ilUnchanged;
  IsolationLevel    := NewIsolationLevel;
end;

More specific it crashes on the following line

Code:
IsolationLevel    := NewIsolationLevel;

Setting my session IsolationLevel to ilUnchanged made the connection work, but why?
 
Setting the isolation level will lead to the execution of an "alter session" query. I'm not sure why that would lead to an exception with an empty message. Furthermore you would expect a similar exception for the next query that is executed. This is not the case?
 
It seems all works well until an actual query on the database is done. That would explain why changing the IsolationLevel on the Session componenent to ilUnchanged, prevents an earlier AV because the alter session query isn't triggered.
 
Last edited:
I'm not sure what could cause this. It is most likely an environment issue though. Perhaps you can verify that the NLS_LANG environment variable is set correctly and that the correct OCI.DLL has been loaded?

 
Any tips on how to check this?

When i let the application perform a tnsping i can see it uses a 64-bit client (result = 11.2.0.4.0 (64-bit) )

My path settings look like this:
c:\oracle\x64-client\bin;c:\oracle\x32-client\bin

NLS_LANG = DUTCH_THE NETHERLANDS.WE8MSWIN1252 (from the registry)

As you can see i am really at a dead end atm.
 
Last edited:
Hello F van Schaik,
we're facing the same problem as you in these days.
Could you please remember what was wrong with the previous Oracle installation? And what was the soution you found?
Thanks
 
Hi Marco,
I checked in depth the behavior and it seems to belong to DOA components.

I tried a simple application with a DOA Connection (TOracleSession) and a FireDAC connection (TFDCOnnection) against the same database.
The application is compiled in 64bit, Oracle Client 64bit is also correctly installed.

The DOA Connection works fine if the application is a dekstop exe. while it doesn't work if it is compiled as ISAPI library.
FireDAC connection works fine in both situations.
The class exception is EOracleError with an empty message.

I also verified that DOA connection works fine in IIS 7.x (Windows7) while doesn't work in IIS 8 and above (Windows10, Windows 2012, etc...).

Could you please verify it?
 
You can download a test project fromhttp://www.mondoedp.com/uploads/media/irisftp/download/Test_ISAPI_DO64.zip

Delphi 10.2.3 - It needs IntraWEB 15.
In Unit3 you have to assign the correct connection parameters.

Project1SA is the stand-alone exe version that woeks fine.
ProjectISAPI is the IIS-dll version that can't connect with TOracleSession.

Note: for some reason FDConnection must be connected first then DOA, I didn't investigate but it doesn't matter in this case.
 
Excuse me Marco,
we really need to use our application in 64-bit IIS environment...
Could you please let me know?

I'm waiting for your reply.
Best regards.
 
Back
Top