Learn how to a build a cloud-first strategyRegister Now


Web Service cannot connect to Access db on remote server

Posted on 2005-04-12
Medium Priority
Last Modified: 2010-04-05
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.

Question by:doug_stephens
  • 3
  • 3
LVL 13

Accepted Solution

BlackTigerX earned 375 total points
ID: 13767659
the problem is access rights, check what user runs your web service, in IIS, go to the scripts virtual folder
- right click, properties
- Directory Security
- Edit

check the user that is specified in the anonymous access, and if necessary specify an account that can see and has rights to the folder where you have your database

Author Comment

ID: 13767927
When I connect to the server directory from Windows, I do need to specify a domain / user / password which is
different than that of my machine, so I think we are on the right track.

Is the "scripts virtual folder" = the inetpub\wwwroot directory where my web service app lives? I opened
the properites from IIS Admin and  specified the correct logon info for the anonymous access.
And got same result when I ran the service - hangs on open.

Also have checked (under Anon access):  Basic authentication and Integrated Windows authentication.

LVL 13

Expert Comment

ID: 13768020
just for... just in case... restart IIS

from the services (Windows Start Menu, Run, type services.msc)
select IIS Admin Service, right click and Restart

and try again

now, your DLL (web service) is in the scripts virtual folder right?... if not, you need to specify the logon information in the folder where your webservice is located
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

LVL 13

Expert Comment

ID: 13773249
by the way, if you can put these machines on a domain, or active directory you would have a lot less problems, you would still have to assign a user name with rights on the target machine, but it works a  lot smoother

Author Comment

ID: 13784611
Restarted IIS. Doesn't seem to want to connect to any database off my local machine,
no matter what I try with the properties of the virtual folder. Yes, my dll is in there.
I'll talk to the local network guy. I'm just a consultant here, not properly defined to the network
so maybe that is the problem. Obviously something wrong with how I'm specifying the access.
currently I have user as DOMAINNAME\username and have checked "let IIS manage password"
although I'm not sure what that means.

I would have expected that if I did not have anon access defined but I had Windows auth checked that
the system would prompt me for a user / password, but no.

Also, I wonder why I don't see an exception or any error messages in the IDE. I have a breakpoint on the .open line which I reach
but that's it. Is that normal?

Active directory sounds cool but I'd like to get this thing working first. I'm already more than a little overwhelmed with everything
else I've had to learn recently!

BTW, how much memory do you need to run B2005? I'm thrashing with 500mb under xpp.

Author Comment

ID: 13785434
Also, wonder why I get a HTTP 500 error in my browser, instead of 403 Access Denied msg?

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month20 days, 15 hours left to enroll

810 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