Recent

Author Topic: How to connect to Oracle from daemon?  (Read 11326 times)

Prg1

  • New member
  • *
  • Posts: 7
How to connect to Oracle from daemon?
« 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)  :'(

jixian.yang

  • Full Member
  • ***
  • Posts: 173
Re: How to connect to Oracle from daemon?
« Reply #1 on: March 11, 2011, 10:10:40 am »
Set Connection:=true at design time?

xenblaise

  • Sr. Member
  • ****
  • Posts: 358
Re: How to connect to Oracle from daemon?
« Reply #2 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
« Last Edit: March 14, 2011, 07:34:40 am by xenablaise »

Prg1

  • New member
  • *
  • Posts: 7
Re: How to connect to Oracle from daemon?
« Reply #3 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  :(

Prg1

  • New member
  • *
  • Posts: 7
Re: How to connect to Oracle from daemon?
« Reply #4 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...  :'(

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2496
Re: How to connect to Oracle from daemon?
« Reply #5 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
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

Prg1

  • New member
  • *
  • Posts: 7
Re: How to connect to Oracle from daemon?
« Reply #6 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.

jixian.yang

  • Full Member
  • ***
  • Posts: 173
Re: How to connect to Oracle from daemon?
« Reply #7 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. 


Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2496
Re: How to connect to Oracle from daemon?
« Reply #8 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.
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

Prg1

  • New member
  • *
  • Posts: 7
Re: How to connect to Oracle from daemon?
« Reply #9 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;)

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2496
Re: How to connect to Oracle from daemon?
« Reply #10 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
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

jixian.yang

  • Full Member
  • ***
  • Posts: 173
Re: How to connect to Oracle from daemon?
« Reply #11 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.