Error opening db in service

J

John

Hi

My app is in vb.net but the backend db is access. I am posting my question
here as there is more access expertise here than in vb.net group.

Here is the problem; I am opening a connection on a shared access db as
below.

Conn = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=\\Server\f\Events Data\Events Data.mdb;User
Id=admin;Password=;")

Conn.open()

This works fine when used in a vb.net win app. The problem is that as soon
as I turn the app into a service or run it using windows scheduler I get
error on conn.open statement. 'The Microsoft Jet database engine cannot open
the file '\\Server\f\Events Data\Events Data.mdb'. It is already opened
exclusively by another user, or you need permission to view its data.'.

Why would the db have a problem opening in a service compared with a normal
win app? How can I open the db in a service?

Thanks

Regards
 
T

Tony Toews

John said:
Why would the db have a problem opening in a service compared with a normal
win app? How can I open the db in a service?

Does the user account under which that service runs have read/write
privileges to the folder in which the Access MDB resides?

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 
J

John

The service is running under LocalSystem. Not sure how LocalSystem works
with permissions on a shared drive.

Thanks

Regards
 
R

rustyga

Permissions is probably the problem. When running as a win app, the use
you ran under must have access to that share. Localsystem does no
assume such permissions.

One way to solve this is to set up the share, on the source system, a
a null session share (HKEY_LOCAL_MACHINE
SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters
NullSessionShares = [multiple values] (REG_MULTI_SZ)).

I have a problem in that I am accessing a share on an IBM AS400, s
need to find a way to give localsystem the necessary access. The IB
website http://tinyurl.com/4lmxr has something that may apply to yo
(page down to "Client Access Security API Samples"). These should wor
no matter what source machine.

Where I need help is in how to setup and run the suggested scripts
I'm not a programmer.



BTW, you're doing the right thing using UNC and not a shared driv
letter. Localsystem is problematic if you use shared drive letters


-
rustyg
 
T

Tony Toews

John said:
The service is running under LocalSystem. Not sure how LocalSystem works
with permissions on a shared drive.

I'm not at all sure why but that's the area I'd concentrate on. You
may need to log onto that system as an administrator and give the
LocalSystem account (or however it works) read/write/delete access to
the folders.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top