Web Service cannot connect to Access db on remote server

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;
begin
  BdpConnection1.Open;
  BdpDataAdapter1.SelectCommand.CommandText := 'SELECT * FROM …’
  BdpDataAdapter1.Active := True;
  r := BdpDataAdapter1.SelectCommand.ExecuteReader;
  i := 0;
  while r.Read do
    inc(i);
  r.Close;
  BdpConnection1.Close;
  result := IntToStr(i)+ '  RECORDS';
end;

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:

database=\\ServerX\....\thedb.mdb;assembly=Borland.Data.Msacc,Version=2.0.0.0,Culture=neutral,PublicKeyToken=91d62ebb5b0d1b1b;vendorclient=msjet40.dll;provider=MSAccess;username=XXXX;password=yyyy

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.

LVL 1
doug_stephensAsked:
Who is Participating?
 
BlackTigerXConnect With a Mentor Commented:
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
0
 
doug_stephensAuthor Commented:
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.


0
 
BlackTigerXCommented:
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
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
BlackTigerXCommented:
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
0
 
doug_stephensAuthor Commented:
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.
0
 
doug_stephensAuthor Commented:
Also, wonder why I get a HTTP 500 error in my browser, instead of 403 Access Denied msg?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.