Solved

Service written in Delphi 2006 that use ADO

Posted on 2008-10-10
3
1,113 Views
Last Modified: 2013-11-23
I'm writing a windows service using delphi 2006, the service need to make access to an postgre sql  database using ado.
I've, in the service, a TADOConnection, when I try to connect the database using
ADOConnection1.Connected := true i receive the error:

"Project Service1.exe raised exception class EOleException with message '[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified'."

The connection string is well placed because if i use the same connection string in a normal vcl application works fine.

The problem is in the service "architecture" i think that I must initialize something, but I don't know what, ie before that error delphi says me that i must call coinitialize to make it work, I've called it using the call:
Olecheck(CoInitialize(nil)); but after I've got the previous error.

Any idea to solve the problem?

0
Comment
Question by:maxc72
3 Comments
 
LVL 27

Assisted Solution

by:BigRat
BigRat earned 50 total points
ID: 22687068
Normally Delphi provides everything needed to initialize and run a service. Clearly if the service thread is to run OLE then CoInitialize() must be called.

It could be however that the service is being run under a default account which has no access to the connectoon tables. Try adding the system login and password to the service (in the service console app)
0
 
LVL 15

Assisted Solution

by:mikelittlewood
mikelittlewood earned 50 total points
ID: 22687558
I usually create a specific network service account but if you want to give it database access you are going to either have to add it to a network group that also has access to the database or specifically name the user on the database.
0
 

Accepted Solution

by:
maxc72 earned 0 total points
ID: 22701103
Thank's for your help, I've found the solution, the dns, was creater under "user dsn" so when the system account will try to find it, it was unable to do it, tha solution is to create a system dsn, now it works :)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now