Connexion to Oracle with a TServiceApplication

Hi,
i think someone had my pb, but no real answers were made :
I made 2 project with the same code inside : In the create event, i just make a connection to oracle. If the connection is ok, it finally writes "ok" in a log, if not, it just writes "not ok".
Here is the code :

============================================
function TServiceToto.test : Boolean;
var res : Boolean ;
begin
res := False ;
try
try
oratest.Connected := False ;
oratest.LogonDatabase := 'logondatabase' ; oratest.LogonUsername := 'username' ;
oratest.LogonPassword := 'password' ;
SauveInfoLocal('before');
oratest.Connected := True ;
SauveInfoLocal('after');
res := True ;
except
on E:Exception do
SauveInfoLocal(E.Message);
end ;
finally
result := res ;
end ;
end ;
============================================

So i call the test function on the create of the project.

On an oracle server (8.1.7.0.0), the service and the application work fine : they both write in the log that the connection is ok.
So the log looks like :
before
after
ok

On an oracle client (8.1.7.0.0), the application works fine. But the service does not work !! No error !!!! But it does not write
here is how the log looks like :

before
after
ok
before

=> so, when i install the service, it writes :
before
after
ok

But when i start the service, it seems to hang up....and it just writes :
before

=> no errors are generated !!!

I dont understand !!!

The difference is that on one side i have Oracle server, and on the other side i have oracle client.

Please help,
this is an emergency !!!

I really really don't understand !!!

Thanks in Advance,
Laurent.
 
It seems that the logon process is hanging. Perhaps you can enable SQL Net tracing to verify what happens when your service attempts to connect?

------------------
Marco Kalter
Allround Automations
 
well...i am not used with enabling SQL Net tracing...
I suppose i have to change the SQLTrace property of my TOracleSession to stTrue...
and then ??? what do i have to do ?

Thanks in advance,
Laurent
 
This is an Oracle Net facility. You do not need to change your application:

[*] Edit \Network\Admin\sqlnet.ora using notepad or wordpad

[*] Change trace_level_client=OFF to trace_level_client=USER (or add this line)

[*] Save the sqlnet.ora file

[*] Run the application

[*] Tracing file is located in the application directory (sqlnet.log). Please send this file to me.

[*] Change trace_level_client=USER to trace_level_client=OFF

[*] Save the sqlnet.ora file
[/list]

------------------
Marco Kalter
Allround Automations
 
Hi !
Thank you for your help...but in fact, I've just solved my pb :
When my service did not work well, i put the code in the OnCreate event of the service to connect to the database => the connexion hanged up when starting...but not when installing...

Now i've just cut-past the same code to the OnStart event of my service and it's OK !!! (with oracle client !!)

I don't really understand why my code works fine in the OnStart event and not in the OnStart event...

You may have any ideas about it ?

I'd glad to know.

Thanks a lot again !

Laurent.
 
Back
Top