Solved

Service written in Delphi 2006 that use ADO

Posted on 2008-10-10
3
1,105 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi 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 use and create new code templates in NetBeans IDE 8.0 for Windows.

763 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

6 Experts available now in Live!

Get 1:1 Help Now