Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_database_setup thread: Unable to connect to and MDB outside the InetPub folder ?


Message #1 by "A. Awadi" <aymawadi@y...> on Sat, 9 Feb 2002 05:50:42
Hi all..

I have an Access.mdb database file, stored at some folder outside the 

InetPub, the share is defined and been used by many users.



I have made an ASP page to make part of the information available for 

other users through the intranet, this is the code segment that I used to 

make the connection:



on error resume next

set cn = Server.CreateObject("ADODB.CONNECTION")

cn.CursorLocation = adUseServer



' IIS is running on NT4.0, provider "Microsoft.Jet.OLEDB.4.0" not there

cn.Open "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=E:\Data\Mydb.mdb"



I always got this error at this point:

Error Number: 3704

Error Description: The operation requested by the application is not 

allowed if the object is closed.





Please tell me where did I get wrong, I have tried many things, including:

1) Adding the Everyone group to the share with full access.

2) Giving IUSR_SERVERNAME full access on that share.

3) Only when I put a copy of MyDb.mdb in the web folder I managed to 

access it using the above code, but I need to keep it where it is!!



Thanks a lot.

Message #2 by "Ken Schaefer" <ken@a...> on Mon, 11 Feb 2002 11:42:15 +1100
Please take out "On Error Resume Next", run the code again, and send us the

error message. I suspect that the error is not occuring on the lines you

have posted, but later on in your code.



Cheers

Ken



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

From: "A. Awadi" <aymawadi@y...>

Subject: [asp_database_setup] Unable to connect to and MDB outside the

InetPub folder ?





: I have an Access.mdb database file, stored at some folder outside the

: InetPub, the share is defined and been used by many users.

:

: I have made an ASP page to make part of the information available for

: other users through the intranet, this is the code segment that I used to

: make the connection:

:

: on error resume next

: set cn = Server.CreateObject("ADODB.CONNECTION")

: cn.CursorLocation = adUseServer

:

: ' IIS is running on NT4.0, provider "Microsoft.Jet.OLEDB.4.0" not there

: cn.Open "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=E:\Data\Mydb.mdb"

:

: I always got this error at this point:

: Error Number: 3704

: Error Description: The operation requested by the application is not

: allowed if the object is closed.

:

:

: Please tell me where did I get wrong, I have tried many things, including:

: 1) Adding the Everyone group to the share with full access.

: 2) Giving IUSR_SERVERNAME full access on that share.

: 3) Only when I put a copy of MyDb.mdb in the web folder I managed to

: access it using the above code, but I need to keep it where it is!!



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



Message #3 by "A. Awadi" <aymawadi@y...> on Mon, 11 Feb 2002 06:52:22
Hi ken,



this is the entire asp after I removed the err-trapping



<% Response.Buffer = false %>

<!-- #INCLUDE FILE="..\DbConsts.asp" -->

<!-- #INCLUDE FILE="..\ErConsts.asp" -->



<% 

dim cn, rs

set cn = Server.CreateObject("ADODB.CONNECTION")

cn.CursorLocation = adUseServer

cn.Open "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=E:\Data\Diary.mdb"

	

set rs = Server.CreateObject("ADODB.RECORDSET")

rs.CursorLocation = adUseServer

	

sSql = "SELECT Entities.* FROM Entities " & _

       "WHERE (Entities.EntityName Like '" & txtEntityName & "');"

rs.Open sSql, cn, adOpenForwardOnly, adLockReadOnly

	

Response.Write "<HTML dir=rtl>"

Response.Write "<HEAD>"

Response.Write "<META NAME='GENERATOR' Content='Microsoft Visual Studio 

6.0'>"

Response.Write "<LINK REL='stylesheet' TYPE='text/css' 

HREF='\Styles\General.CSS'>"

Response.Write "<TITLE>Test</TITLE>"

Response.Write "</HEAD>"

Response.Write "<BODY>"

Response.Write "End of test"

Response.Write "</BODY></HTML>"

	

rs.Close

cn.Close

set rs= nothing

set cn= nothing

%>





And this is the result copied from my browser



Microsoft JET Database Engine error '80004005' 



The Microsoft Jet database engine cannot open the file 'E:\Grp-

Main\Damk\AmkDiary.mdb'. It is already opened exclusively by another user, 

or you need permission to view its data. 



/AmkDiary/Search.asp, line 9





I hope this would be of help, thanks in advance

Awadi
Message #4 by "Ken Schaefer" <ken@a...> on Mon, 11 Feb 2002 17:53:56 +1100
That error is caused because either:

a) someone already has the database open (eg you have it open in Access),

and has an exclusive lock on the table (eg you are looking at the properties

of the table)



    - or -



b) The IUSR_<machinename> account does not have sufficient permissions to

the file/folder. The IUSR_<machinename> account needs permission to the

actual file (the .mdb file), and also the *folder* that the file is in

(because it needs to be able to create/destroy the .ldb lockfile).

Right-click on the \Damk folder on your E-Drive and replace the permissions

with Everyone - Full Control (and tick the box to apply this to all

files/subfolders etc). Make sure there is no Deny permission for anyone. If

things start to work, then you can tighten the permissions again.



c) Additionally, Jet needs access to the %systemroot%\Temp folder (because

it likes to stick various temp files there - but since you got this working

by moving the database, I think the problem is caused by (b)



Cheers

Ken



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

From: "A. Awadi" <aymawadi@y...>

Subject: [asp_database_setup] Re: Unable to connect to and MDB outside the

InetPub folder ?





: this is the entire asp after I removed the err-trapping

: And this is the result copied from my browser

:

: Microsoft JET Database Engine error '80004005'

:

: The Microsoft Jet database engine cannot open the file 'E:\Grp-

: Main\Damk\AmkDiary.mdb'. It is already opened exclusively by another user,

: or you need permission to view its data.

:

: /AmkDiary/Search.asp, line 9

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



Message #5 by "e n z o" <enzaux@g...> on Mon, 11 Feb 2002 23:26:51 +0800
HI, I have no intention of overwriting the topic of this post but I just

want to ask Ken about my case.



In WINNT 4.0 when I have my MSAccess database compacted and repaired it is

still accessible by my asp program but when I transferred to Windows 2000 I

can't accessed through an ASP program the database that has been compacted

and repaired :(  What I was doing is I'll CUT  this database to another

location then I'll COPY this again back to the original folder to remove the

exclusive lock.



I understand when the compacting is made, The database is duplicated

(db1.mdb) then it is opened exclusively then compact.  Then delete the old

mdb file then rename db1.mdb  the same with the file name of the deleted

file, Leaving this copy of database open exclusively.  But I was just

wondering why is it I can connect to the database through ASP but in windows

2000 it won't?



Thanks,



Enzo

----- Original Message -----

From: "Ken Schaefer" <ken@a...>

To: "ASP Database Setup" <asp_database_setup@p...>

Sent: Monday, February 11, 2002 2:53 PM

Subject: [asp_database_setup] Re: Unable to connect to and MDB outside the

InetPub folder ?





> That error is caused because either:

> a) someone already has the database open (eg you have it open in Access),

> and has an exclusive lock on the table (eg you are looking at the

properties

> of the table)

>

>     - or -

>

> b) The IUSR_<machinename> account does not have sufficient permissions to

> the file/folder. The IUSR_<machinename> account needs permission to the

> actual file (the .mdb file), and also the *folder* that the file is in

> (because it needs to be able to create/destroy the .ldb lockfile).

> Right-click on the \Damk folder on your E-Drive and replace the

permissions

> with Everyone - Full Control (and tick the box to apply this to all

> files/subfolders etc). Make sure there is no Deny permission for anyone.

If

> things start to work, then you can tighten the permissions again.

>

> c) Additionally, Jet needs access to the %systemroot%\Temp folder (because

> it likes to stick various temp files there - but since you got this

working

> by moving the database, I think the problem is caused by (b)

>

> Cheers

> Ken

>

> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

> From: "A. Awadi" <aymawadi@y...>

> Subject: [asp_database_setup] Re: Unable to connect to and MDB outside the

> InetPub folder ?

>

>

> : this is the entire asp after I removed the err-trapping

> : And this is the result copied from my browser

> :

> : Microsoft JET Database Engine error '80004005'

> :

> : The Microsoft Jet database engine cannot open the file 'E:\Grp-

> : Main\Damk\AmkDiary.mdb'. It is already opened exclusively by another

user,

> : or you need permission to view its data.

> :

> : /AmkDiary/Search.asp, line 9

> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

>

>




$subst('Email.Unsub')

>




$subst('Email.Unsub').

>




  Return to Index