Lazarus

Programming => Databases => Topic started by: Prg1 on March 11, 2011, 05:49:14 am

Title: How to connect to Oracle from daemon?
Post by: Prg1 on March 11, 2011, 05:49:14 am
Well, i've wrote a daemon(service) app for Windows, wich must to connect to any DB server using ZeosDB. It can connect to mySQL, FireBird, MSSQL, but can't connect to Oracle. When i trying set Connection:=true, process hangs. This happens only in daemon app. Traditional GUI app has no problem.
Please, help (if anybody knows how to)  :'(
Title: Re: How to connect to Oracle from daemon?
Post by: jixian.yang on March 11, 2011, 10:10:40 am
Set Connection:=true at design time?
Title: Re: How to connect to Oracle from daemon?
Post by: xenblaise on March 11, 2011, 04:29:10 pm
I think this was the bug discussed in the other post.
I'm sure you have Delphi installed?

Ok, try something like this;
if the connection base is oracle or ms_access<try this data model if same problem>

Then try to set in TSQLQuery;
UsePrimaryKeyAsKey to False

Don't set the connection to true until UsePrimaryKeyAsKey is set to False
Title: Re: How to connect to Oracle from daemon?
Post by: Prg1 on March 15, 2011, 06:13:01 am
Thank you, xenablaise. I'll try as you wrote later, when i'll solve a problem with connection.
It just cant connect to oracle at runtime. At design time it connects perfect. When service is running, an attempt to connect to Oracle hangs app. That is, when i set TZConnection's property Connected to true, this service app stops responding.
Please, note, that i use Zeos Access components, not SQLdb.

help is very needed, amigos  :(
Title: Re: How to connect to Oracle from daemon?
Post by: Prg1 on March 15, 2011, 09:08:57 am
I just made service app in Delphi, using Zeos Access, and connection to Oracle has been suxessfully established. Seems like a problem is in Lazarus or FPC.
 
enyone knows a problem?

P.S goodbye my dream about crossplatform web server with internal oracle support...  :'(
Title: Re: How to connect to Oracle from daemon?
Post by: Marc on March 15, 2011, 11:31:34 am
lazarus + zeos work too, so I fail to see why you cannot connect to oracle.
Maybe some path is different, so your service cannot find the oracle dlls
Title: Re: How to connect to Oracle from daemon?
Post by: Prg1 on March 15, 2011, 12:36:48 pm
Marc,
Quote

Maybe some path is different, so your service cannot find the oracle dlls
Why then it connects at design time successfully? and service written in Delphi + Zeos also connects fine?
 %) can't see a reason of this behavior.
Title: Re: How to connect to Oracle from daemon?
Post by: jixian.yang on March 15, 2011, 02:42:41 pm
Does another service of yours work fine?

For test, a form with a dbgrid and a button to be used to open table could show while the service started with service management in control panel. 

Title: Re: How to connect to Oracle from daemon?
Post by: Marc on March 15, 2011, 05:01:01 pm
Marc,
Quote

Maybe some path is different, so your service cannot find the oracle dlls
Why then it connects at design time successfully? and service written in Delphi + Zeos also connects fine?
 %) can't see a reason of this behavior.

A service path can be different from a user path, so I see at least one reason.
Title: Re: How to connect to Oracle from daemon?
Post by: Prg1 on March 16, 2011, 04:14:18 am
jixian.yang, yes. as i posted above, a service written in Delphi works fine and GUI app with a grid works perfect, but service of FPC/Lazarus hangs when Connected is set to true.
Marc, then can you please write me, how can i set a correct path to oracle dlls?
Environment variables are correct (c:\apps\oracle\product\10.2.0\client_1\bin;)
Title: Re: How to connect to Oracle from daemon?
Post by: Marc on March 16, 2011, 12:58:53 pm
jixian.yang, yes. as i posted above, a service written in Delphi works fine and GUI app with a grid works perfect, but service of FPC/Lazarus hangs when Connected is set to true.


I think jixian.yang meant a Lazarus service

Quote
Marc, then can you please write me, how can i set a correct path to oracle dlls?
Environment variables are correct (c:\apps\oracle\product\10.2.0\client_1\bin;)

if you set this a system variable (opposite to user variable) then OK
Title: Re: How to connect to Oracle from daemon?
Post by: jixian.yang on March 16, 2011, 01:53:40 pm
jixian.yang, yes. as i posted above, a service written in Delphi works fine and GUI app with a grid works perfect, but service of FPC/Lazarus hangs when Connected is set to true.


I think jixian.yang meant a Lazarus service

Quote
Marc, then can you please write me, how can i set a correct path to oracle dlls?
Environment variables are correct (c:\apps\oracle\product\10.2.0\client_1\bin;)

if you set this a system variable (opposite to user variable) then OK

And set NLS_LANG and ORACLE_HOME too.

TinyPortal © 2005-2018