|
 |
asp_database_setup thread: Connecting to MsAccessDb on a remote server
Message #1 by "A. Awadi" <aymawadi@y...> on Mon, 4 Feb 2002 14:17:52
|
|
Hi all..
I am working on a project where I have an Access-97 database on a Windows
NT server, and the IIS on a Windows 2000 server.
I have tried many ways to establish a connection to the database file from
my ASP including:
1) Mapping a drive to the database location from the win2000 machine, and
then using that drive letter in my ASP as follows
cn.open "Provider=Microsoft.Jet.OLEDB.4.0;data source=X:\MyDb.mdb"
2) Creating a DSN on the win2000 machine to the database, and then using
that dsn in my asp as follows
cn.Open "dsn=mydsn"
3) Using the share name of the folder where the database is stored, as
follows
cn.open "Provider=Microsoft.Jet.OLEDB.4.0;data
source=\\NtServer\MyDbShareName\MyDb.mdb"
All attempts failed, every attempt generated the error 3704, "Operation is
not allowed when the object is closed."
However, when I copied the Mydb.mdb to the Win2000 machine, I was able to
open the connection as follows
cn.open "Provider=Microsoft.Jet.OLEDB.4.0;data
source=C:\inetpub\MyWeb\MyDb.mdb"
Does anyone know anything that might help, appreciating very much your
kind attention.
Message #2 by "Vincent Vandermeeren \(mailinglists only\)" <vinnie@j...> on Mon, 4 Feb 2002 19:13:10 +0100
|
|
Hi Awadi,
to have more succes you can make a virtual directory on the IIS server who
point to the machine where the database is standing.
That's the way I did it and it works still perfect ... !!
If you still have questions ..shoot !!
Greetings,
Vinnie
----- Original Message -----
From: "A. Awadi" <aymawadi@y...>
To: "ASP Database Setup" <asp_database_setup@p...>
Sent: Monday, February 04, 2002 2:17 PM
Subject: [asp_database_setup] Connecting to MsAccessDb on a remote server
> Hi all..
> I am working on a project where I have an Access-97 database on a Windows
> NT server, and the IIS on a Windows 2000 server.
>
> I have tried many ways to establish a connection to the database file from
> my ASP including:
>
> 1) Mapping a drive to the database location from the win2000 machine, and
> then using that drive letter in my ASP as follows
> cn.open "Provider=Microsoft.Jet.OLEDB.4.0;data source=X:\MyDb.mdb"
>
> 2) Creating a DSN on the win2000 machine to the database, and then using
> that dsn in my asp as follows
> cn.Open "dsn=mydsn"
>
> 3) Using the share name of the folder where the database is stored, as
> follows
> cn.open "Provider=Microsoft.Jet.OLEDB.4.0;data
> source=\\NtServer\MyDbShareName\MyDb.mdb"
>
> All attempts failed, every attempt generated the error 3704, "Operation is
> not allowed when the object is closed."
>
> However, when I copied the Mydb.mdb to the Win2000 machine, I was able to
> open the connection as follows
> cn.open "Provider=Microsoft.Jet.OLEDB.4.0;data
> source=C:\inetpub\MyWeb\MyDb.mdb"
>
> Does anyone know anything that might help, appreciating very much your
> kind attention.
>
$subst('Email.Unsub')
>
$subst('Email.Unsub').
>
Message #3 by "Ken Schaefer" <ken@a...> on Tue, 5 Feb 2002 11:50:23 +1100
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "A. Awadi" <aymawadi@y...>
Subject: [asp_database_setup] Connecting to MsAccessDb on a remote server
: Hi all..
: I am working on a project where I have an Access-97 database on a Windows
: NT server, and the IIS on a Windows 2000 server.
:
: I have tried many ways to establish a connection to the database file from
: my ASP including:
:
: 1) Mapping a drive to the database location from the win2000 machine, and
: then using that drive letter in my ASP as follows
: cn.open "Provider=Microsoft.Jet.OLEDB.4.0;data source=X:\MyDb.mdb"
:
: 2) Creating a DSN on the win2000 machine to the database, and then using
: that dsn in my asp as follows
: cn.Open "dsn=mydsn"
:
: 3) Using the share name of the folder where the database is stored, as
: follows
: cn.open "Provider=Microsoft.Jet.OLEDB.4.0;data
: source=\\NtServer\MyDbShareName\MyDb.mdb"
:
: All attempts failed, every attempt generated the error 3704, "Operation is
: not allowed when the object is closed."
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A drive letter is mapped for the logged on user *only*. On a WinNT/2k/XP
machine IIS (and hence ASP) does not run under the context of the logged on
user. Instead, file/DB access is done via the anonymous internet user
account (by default), which is IUSR_<machinename> or (IWAM_<machinenane> for
out-of-process websites).
Since the IUSR_<machinename> account is a local account (except on NT domain
controllers where there are no local accounts), you can't add it to the ACL
for a share on the remote machine. Instead, you have the following options:
a) Change the account that ASP is using to a domain account that has
permissions to the remote share. Be aware of the risks associated with
elevating the priveleges of the account used by your website for file access
b) Create an account on the remote machine with the same username/password
combination as the anonymous user account on your webserver. Give this
account permission to the share. In your ASP pages you will have to connect
via UNC names \\computer\share because mapped drives are only there for the
logged on user
c) Use a HTTP authentication system that forces the user to provide NT user
account credentials (Basic or NTCR). These account credentials should be
domain accounts that have permissions to the remote share
Cheers
Ken
Message #4 by "A. Awadi" <aymawadi@y...> on Sat, 9 Feb 2002 05:42:59
|
|
Hi Ken..
Thanks for your suggestions. I had tried them all, but get to nowhere. I
think I had some problem but don't know what exactly it is.
I have made some changes, now both the Web and Data are on the same
server, but still unable to connect, the MDB file is outside the InetPub
folder, my ASP is not getting to it.
In one of my attempts, I added the Everyone group to the share where the
data is, I gave full access, I also added IUSR_SERVER to the same share
with no progress, I ahve also created an alias to the directory where data
is (virtual directory) and also failed, only when I put a copy of that MDB
in the WEB folder it worked fine using this code segment
on error resume next
set cn = Server.CreateObject("ADODB.CONNECTION")
cn.CursorLocation = adUseServer
cn.Open "Provider=Microsoft.Jet.OLEDB.3.51;Data
Source=E:\InetPup\MyWeb\DataMydb.mdb"
Where do you think I get wrong ??
A. Awadi
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> From: "A. Awadi" <aymawadi@y...>
> Subject: [asp_database_setup] Connecting to MsAccessDb on a remote server
>
>
> : Hi all..
> : I am working on a project where I have an Access-97 database on a
Windows
> : NT server, and the IIS on a Windows 2000 server.
> :
> : I have tried many ways to establish a connection to the database file
from
> : my ASP including:
> :
> : 1) Mapping a drive to the database location from the win2000 machine,
and
> : then using that drive letter in my ASP as follows
> : cn.open "Provider=Microsoft.Jet.OLEDB.4.0;data source=X:\MyDb.mdb"
> :
> : 2) Creating a DSN on the win2000 machine to the database, and then
using
> : that dsn in my asp as follows
> : cn.Open "dsn=mydsn"
> :
> : 3) Using the share name of the folder where the database is stored, as
> : follows
> : cn.open "Provider=Microsoft.Jet.OLEDB.4.0;data
> : source=\\NtServer\MyDbShareName\MyDb.mdb"
> :
> : All attempts failed, every attempt generated the error
3704, "Operation is
> : not allowed when the object is closed."
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> A drive letter is mapped for the logged on user *only*. On a WinNT/2k/XP
> machine IIS (and hence ASP) does not run under the context of the logged
on
> user. Instead, file/DB access is done via the anonymous internet user
> account (by default), which is IUSR_<machinename> or (IWAM_<machinenane>
for
> out-of-process websites).
>
> Since the IUSR_<machinename> account is a local account (except on NT
domain
> controllers where there are no local accounts), you can't add it to the
ACL
> for a share on the remote machine. Instead, you have the following
options:
>
> a) Change the account that ASP is using to a domain account that has
> permissions to the remote share. Be aware of the risks associated with
> elevating the priveleges of the account used by your website for file
access
>
> b) Create an account on the remote machine with the same
username/password
> combination as the anonymous user account on your webserver. Give this
> account permission to the share. In your ASP pages you will have to
connect
> via UNC names \\computer\share because mapped drives are only there for
the
> logged on user
>
> c) Use a HTTP authentication system that forces the user to provide NT
user
> account credentials (Basic or NTCR). These account credentials should be
> domain accounts that have permissions to the remote share
>
> Cheers
> Ken
>
Message #5 by "Ken Schaefer" <ken@a...> on Mon, 11 Feb 2002 11:45:30 +1100
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "A. Awadi" <aymawadi@y...>
Subject: [asp_database_setup] Re: Connecting to MsAccessDb on a remote
server
: Thanks for your suggestions. I had tried them all, but get to nowhere. I
: think I had some problem but don't know what exactly it is.
:
: I have made some changes, now both the Web and Data are on the same
: server, but still unable to connect, the MDB file is outside the InetPub
: folder, my ASP is not getting to it.
:
: In one of my attempts, I added the Everyone group to the share where the
: data is, I gave full access,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
That is *not* going to work. IUSR_webserver is *local* to the webserver and
can not be given access to a remote share.
If the data is on the webserver, then why are you connecting to a share?!?
The code in your later post shows you are connecting to "drive E" - if this
is mapped to share, then it is only mapped for the logged on user (ie you),
it is not mapped for the IUSR_webserver account.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: I also added IUSR_SERVER to the same share
: with no progress
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
WHICH server is this account on? You said you have *two* servers. One
running the webserver, and one with the database.
If you want to use two local accounts, you need to create an account on the
database server with the same name and password as the anonymous account
being using one the web server.
Cheers
Ken
Message #6 by "A. Awadi" <aymawadi@y...> on Mon, 11 Feb 2002 06:32:44
|
|
Hi Ken,
The two servers solution did not work, so I moved my web to the same
server with the database.
On that server I have a hard disk partion, C: is the primary partion where
I have the NT4.0, IIS4 and program files. D: is the CD-ROM, E: is the
secondary partion where I have the data.
As I said I tried to Access the data using the physical location
i.e. data source=E:\Mydata\Mydb.mdb but still have not succeeded, and that
what made me think the problem is some where else.
What do u think :)
Message #7 by "Ken Schaefer" <ken@a...> on Mon, 11 Feb 2002 17:31:20 +1100
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "A. Awadi" <aymawadi@y...>
Subject: [asp_database_setup] Re: Connecting to MsAccessDb on a remote
server
: As I said I tried to Access the data using the physical location
: i.e. data source=E:\Mydata\Mydb.mdb but still have not succeeded, and that
: what made me think the problem is some where else.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
So:
"Data Source=c:\inetpub\wwwroot\myDB\db1.mdb"
(or similar) works, but:
"Data Source=e:\Mydata\mydb.mdb"
does not work? Also, did you take out On Error Resume Next (so that we can
see a more detailed error, plus see what line the error is occuring on?)
Cheers
Ken
Message #8 by "Drew, Ron" <RDrew@B...> on Mon, 11 Feb 2002 07:43:49 -0500
|
|
See if you can find it using Server.MapPath.
-----Original Message-----
From: Ken Schaefer [mailto:ken@a...]
Sent: Monday, February 11, 2002 1:31 AM
To: ASP Database Setup
Subject: [asp_database_setup] Re: Connecting to MsAccessDb on a remote
server
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "A. Awadi" <aymawadi@y...>
Subject: [asp_database_setup] Re: Connecting to MsAccessDb on a remote
server
: As I said I tried to Access the data using the physical location
: i.e. data source=3DE:\Mydata\Mydb.mdb but still have not succeeded,
and
that
: what made me think the problem is some where else.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
So:
"Data Source=3Dc:\inetpub\wwwroot\myDB\db1.mdb"
(or similar) works, but:
"Data Source=3De:\Mydata\mydb.mdb"
does not work? Also, did you take out On Error Resume Next (so that we
can see a more detailed error, plus see what line the error is occuring
on?)
Cheers
Ken
$subst('Email.Unsub')
$subst('Email.Unsub').
|
|
 |