Solved

Service written in Delphi 2006 that use ADO

Posted on 2008-10-10
3
1,124 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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…
Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
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.
Suggested Courses
Course of the Month5 days, 16 hours left to enroll

627 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