Solved

Service written in Delphi 2006 that use ADO

Posted on 2008-10-10
3
1,121 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

710 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