I am writing a web service application using Delphi 2005 (Update2) and
I’m having some problems pointing to an Access db.
Works fine locally but fails when I specify a db on a server (on our LAN).
As a test, I am just counting the rows in a result set.
Hopefully this is a pretty easy solution involving properly specifying the path.
The code for my service looks like this (except for the details
of the select statement):
function TWebService1.ServiceA: string;
var r : BDPDataReader;
i : Integer;
BdpDataAdapter1.SelectCommand.CommandText := 'SELECT * FROM …’
BdpDataAdapter1.Active := True;
r := BdpDataAdapter1.SelectCommand.ExecuteReader;
i := 0;
while r.Read do
result := IntToStr(i)+ ' RECORDS';
I have set up BdpConnection1 to point to a local copy of the database,
specified as c:\data\mydb.mdb. This works great and I have tested it from
a web client. To point it to the database on a remote server, I specify
something like \\serverX\a\b\mydb.mdb. I am using the Connection Editor
and pointing directly to the file via Network Connections. The “Test” button
says connection is successful. But when I test it running from the IDE, it
always dies on BdpConnection1.Open.
Full text of ConnectionString is:
Ultimately, this service will run on the same server as the database, so I
could probably duplicate the path structure on my local machine and
specify it as localhost:c:\a\b\mydb.mdb. But it may be deployed elsewhere
so I want to specify the actual server name as \\ServerX.