Link to home
Start Free TrialLog in
Avatar of johnhardy
johnhardyFlag for United Kingdom of Great Britain and Northern Ireland

asked on

database opened exclusively by another user, or you need permission to view its data

I have a domain  xxx.co.uk

On the same server I have a domain sslxxx.co.uk

xxx.co.uk has a database which is working OK on my local pc and remote server.

I want to run some of the files of xxx.co.uk on the sslxxx.co.uk

When the pages from sslxxx.co.uk try to use the database connection I get an error message.

The Microsoft Jet database engine cannot open the file 'D:\home\Default\xxx.co.ukxxx2002.mdb'. It is already opened exclusively by another user, or you need permission to view its data.
It seems I have the connection correct but that permissions may be wrong.
In database properties Security is set to Internet Guest Account (machineName) full control
Can anyone see where I am going wrong please
Thanks
John
Avatar of prashsax
prashsax

I think the problem is that the Database is being used by xxx.co.uk website already.

And then if you try and create a connection to it again, it gives you an error.

If you are using database directly, try to make connection using DSN.

I think, this will let you open the database from both the site simultaneously.

Your DB may be in single user mode (default for DBs created using MS Access) with each web site being treated as a single user.  You can test this by stopping the web site that can currently access the DB the restarting the DB that cannot currently access it and trying again.  If successful you will need to change your DB to multi-user mode.  How you do this will depend on what type DB this is (Access or some other) and if you can change the data access methods of these web apps.
Avatar of johnhardy

ASKER

Thanks
The database is Access 2003, can you say how this can be changed into multi user mode, I thought this was standard?
What kind of lock are you using in the connection statement.

You must use optimistic lock and no other lock option.
I cannot see anything about a lock in the code

MM_connUltraCartIIVB_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\home\Default\xxx.co.uk\htdocs\_hide\xxx.mdb;"
It should be in the recordset statement.

rst_name.Open str_source, str_connection, int_cursortype, int_locktype, lng_options

I am talking about int_locktype here.
1.  Open the DB in Access
2.  Go to Tools > Options > Advanced
3.  Set Default open mode to "Shared"
4.  Set Default locking to "No locks"
5.  Save, exit, restart both web apps, and retry

prashsax and johnhardy are talking about how the application handles concurrency (multiple edits to a single record at the same time) with record level locks (or lack thereof).  Your problem is that your working web app has opened the DB with exclusive access (aka single user mode).  Most applications will use the default open mode of the DB so a simple change from "Exclusive" to "Shared" should correct the problem.  Most applications also implement their own methods for handling concurrency so we can set this to "No locks" on the DB and save resources.

If this does not work it is possible that the open mode is coded into your web app.  We can address how to fix that if it comes up.

Thanks very much for the explanation
When I checked the settings in the dbase they were as prescribed. Pity!
Looks like it's coded into the app or dsn.  Can you track down the connection string in the code?  May look something like this:

"Driver={Microsoft Access Driver (*.mdb)}; DBQ=C:\App1\Your_Database_Name.mdb; Exclusive=1; Uid=Your_Username; Pwd=Your_Password;"

or

"Provider=MS Remote; Remote Server=http://Your-Remote-Server-IP; Remote Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\App1\Your_Database_Name.mdb"

or

"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=\\Server_Name\Share_Name\Share_Path\Your_Database_Name.mdb"

or

"ODBC;DSN=MyDSN"

or

"ODBC;FILEDSN=c:\Program Files\Common Files\ODBC\Data Sources\MyDSN.dsn"

Once you have that we should be able to start tracking it down.
I now have two domains on my local server.
One to simulate the main site and one to simulate the ssl part
I am using dsn and on the local machine they can both see the same dsn connection

These two local domains apear to work correctly.

If I route to the ssl remote server, the database shows an error.

On the remote server I can make a connection from the main site to the dsn, but that dsn name does not show in the ssl domain.

This is because the dsn creation seems only to see paths within that domain rather than globally as the local server sees.

It seems to suggest that dsn cannot be used as it cannot be seen by both domains on the remote server.

Perhaps I should retry with the oledb method again?

The connection string at the moment is
Dim MM_connUltraCartIIVB_STRING
MM_connUltraCartIIVB_STRING = "dsn=xxxx;"

Thanks for all the help
Try going dsnless or with a file based dsn:

for ODBC connection string

"Driver= {MicrosoftAccessDriver(*.mdb)};DBQ=C:\App1\Your_Database_Name.mdb;Uid=Your_Username;Pwd=Your_Password;"

OLEDB connection string

"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=\\Server_Name\Share_Name\Share_Path\Your_Database_Name.mdb"


Or go back to:

MM_connUltraCartIIVB_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\home\Default\xxx.co.uk\htdocs\_hide\xxx.mdb;;Mode=Share Deny None;"

Adding Mode=Share Deny None


One these days I'll actually learn to read.  It should look like this:


MM_connUltraCartIIVB_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\Server\share\home\Default\xxx.co.uk\htdocs\_hide\xxx.mdb;;Mode=Share Deny None;"

Adding Mode=Share Deny None
Changing D:\ to \\Server\share\
Thanks
I notice on the remote main site if I use
Source=D:\home\Default\ ... the connection works OK

If I use Source=\\Server\share\ it fails with the error

Microsoft OLE DB Service Components error '80040e73'
Format of the initialization string does not conform to the OLE DB specification.

Should the word "Server" be replaced with a server name, if so where will I find that please?
Yes -

Server = the computername of the machine the DB file is located on
Share = share name of the shared folder the DB file is located on


for example

I Let's say I have an Access DB named Sales.mdb on a computer called Mickey.  The path to the DB file from that computer is D:\Databases\Financial\Sales.mdb but if I want to connect to that database accross the network I will need a file share.  I share out D:\Databases\Financial as Sales.  The path to the DB file from a remote computer would be \\Mickey\Sales\Sales.mdb where Mickey is the computername of the server and Sales is the name of the share.

I hope this makes sense.  If not we'll continue after I've had some sleep.
I hope you slept well if have done some more tests but so far I cannot get the connection.

I have tried as follows

In IIS IUSR_XXXX-WEB-RAW is the name of the general heading Web Sites

Connection used
MM_connUltraCartIIVB_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\IUSR_XXXX-WEB-RAW\share\SmylXXXX.mdb;;Mode=Share Deny None;"
When this is used as the connection on the ssl site it produces and error of:

Microsoft JET Database Engine error '80004005'
'\\IUSR_XXXX-WEB-RAW\share\SmylXXXX.mdb' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.
=======================================

In IIS smylYYYY is the username of the main site smylYYYY (not the secure site, ie its username under IIS>web sites.)
Connection used
MM_connUltraCartIIVB_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\smylYYYY\share\SmylYYYY.mdb;;Mode=Share Deny None;"

This gives an error of
Microsoft JET Database Engine error '80004005'
'\\smylYYYY\share\SmylYYYY.mdb' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.
======================================
Hope this is clear
Thanks for all the help
ASKER CERTIFIED SOLUTION
Avatar of CharliePete00
CharliePete00

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you very much for such a very clear explanation.

I have carried out this method but still cannot make the connection. However with some luck I have a friend who may be able to see where I am going wrong and I will come back soon.
Regards
John
I found that there was a permission required on the site server which was missing. Thanks again for the great assistance
Regards
John