Discussion:
Opening an Access Database on IIS
(too old to reply)
PatK
2008-01-16 23:17:01 UTC
Permalink
Hi!

I am a total noob at writing vbscript on IIS, so am looking for any help you
can provide.

I have IIS running on my own system (to learn) and have an access database
published to a virtual directory. I have no problem accessing "static" asp
type pages accessing http://localhost/mywebsite/test.asp (for example).

However, now I want to be able to open an access database. I am playing the
the "sample" code that came with IIS, and I am unable to even get that to
work For example (code snippet):

' Map authors database to physical path
filePath = Server.MapPath("authors.mdb")
' Create ADO Connection Component to connect with sample database

Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & filePath

I am running XP Pro, and have both Access 2003 and Access 2007 on my PC. I
have tried using both the connection string above (for .mdb formatted file)
as well as one for an Access 2007 (.accdb formatted) that I found on the web,
like:

PROVIDER=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=author.accdb

but also does not work ( note that I save the DB in both .mdb and .accdb
format for each test, depending on the connect string I was planning to use)

No matter what I do, when I open the page with my browser, it craps out at
the line with oConn.Open statement. The Author.mdb file is in the "root" of
my website (altho I have tried moving it to fpdb, as frontpage likes better,
but no diff).

I get a 500.100 error with the following:

-----------------------------------------------------------------
Error Type:
Microsoft JET Database Engine (0x80004005)
Unspecified error
/asometrics/adddelete.asp, line 37


Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705;
.NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.2)

Page:
GET /asometrics/adddelete.asp

Time:
Wednesday, January 16, 2008, 4:13:33 PM

-----------------------------------------------------------------

I am totally dead in the water, as I cannot get past the DB opening request.
HELP! I am going INSANE!

Patk
McKirahan
2008-01-17 03:22:40 UTC
Permalink
Post by PatK
Hi!
I am a total noob at writing vbscript on IIS, so am looking for any help you
can provide.
I have IIS running on my own system (to learn) and have an access database
published to a virtual directory. I have no problem accessing "static" asp
type pages accessing http://localhost/mywebsite/test.asp (for example).
However, now I want to be able to open an access database. I am playing the
the "sample" code that came with IIS, and I am unable to even get that to
' Map authors database to physical path
filePath = Server.MapPath("authors.mdb")
' Create ADO Connection Component to connect with sample database
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & filePath
I am running XP Pro, and have both Access 2003 and Access 2007 on my PC.
I
Post by PatK
have tried using both the connection string above (for .mdb formatted file)
as well as one for an Access 2007 (.accdb formatted) that I found on the web,
PROVIDER=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=author.accdb
but also does not work ( note that I save the DB in both .mdb and .accdb
format for each test, depending on the connect string I was planning to use)
No matter what I do, when I open the page with my browser, it craps out at
the line with oConn.Open statement. The Author.mdb file is in the "root" of
my website (altho I have tried moving it to fpdb, as frontpage likes better,
but no diff).
-----------------------------------------------------------------
Microsoft JET Database Engine (0x80004005)
Unspecified error
/asometrics/adddelete.asp, line 37
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705;
.NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.2)
GET /asometrics/adddelete.asp
Wednesday, January 16, 2008, 4:13:33 PM
-----------------------------------------------------------------
I am totally dead in the water, as I cannot get past the DB opening request.
HELP! I am going INSANE!
If your page is here http://localhost/mywebsite/test.asp
then try putting your database in the same folder if you want
Server.MapPath() to work -- or, if it's in the root, then try:
filePath = Server.MapPath("/authors.mdb") -- note that slash.


Otherwise, show us your code! Strip it down to only the basics.
roger
2008-01-17 12:00:00 UTC
Permalink
Post by PatK
' Map authors database to physical path
filePath = Server.MapPath("authors.mdb")
' Create ADO Connection Component to connect with sample database
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & filePath
I am running XP Pro, and have both Access 2003 and Access 2007 on my PC.
I
Post by PatK
have tried using both the connection string above (for .mdb formatted file)
as well as one for an Access 2007 (.accdb formatted) that I found on the web,
No matter what I do, when I open the page with my browser, it craps out at
the line with oConn.Open statement. The Author.mdb file is in the "root" of
my website (altho I have tried moving it to fpdb, as frontpage likes better,
but no diff).
-----------------------------------------------------------------
Microsoft JET Database Engine (0x80004005)
Unspecified error
/asometrics/adddelete.asp, line 37
I am living happily in the year 1999, so I know nothing of this Access 2003
of which you speak.

However, traditionally the IUSR_<machine name> user needs modify permission
on the folder in which the database resides.

i.e. (in windows explorer) right click on the database folder
choose properties | security | internet guest account (iusr_<machinename>)
and give it modify permission.
It may be slightly different in your version of windows.

Also, see here...
http://tutorials.aspfaq.com/8000xxxxx-errors/80004005-errors.html
--
roger
PatK
2008-01-17 16:43:00 UTC
Permalink
Here is the entire script (keeping it simple). It is failling on the
oConn.Open. Also (to Roger), I do have IUSR_MYSYSTEM set as a the user for
anonymous access. What I have not been able to figure out how to do is allow
that user read/write access, as when I go to the file directory security, as
you noted, it will not allow me to add that user.

Anyway...any insights, would be appreciated. I checked out the other links
you have suggested, and testing various things they suggest (like setting the
read/write mode on the access db), but no joy.

<%

Dim oConn
Dim oRs
Dim filePath

filePath = Server.MapPath("/Authors.mdb")
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.mode = 3 ' adModeReadWrite
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & filePath

%>
Bob Barrows [MVP]
2008-01-17 16:59:51 UTC
Permalink
Post by PatK
Here is the entire script (keeping it simple). It is failling on the
oConn.Open. Also (to Roger), I do have IUSR_MYSYSTEM set as a the
user for anonymous access. What I have not been able to figure out
how to do is allow that user read/write access, as when I go to the
file directory security, as you noted, it will not allow me to add
that user.
What OS? If XP, have you turned off Simple File Sharing?
http://www.aspfaq.com/show.asp?id=2205
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
PatK
2008-01-17 17:23:02 UTC
Permalink
Ultimately, it turned out to be a combination of things. I changed the
permissions to read/write to "everyone" on the access DB. This resulted in a
different error, that I was able to find a MS note on at:

http://support.microsoft.com/default.aspx/kb/315456

and basically, I had to also change the permission on the windows\temp
folder also to everyone, read/write. And It now works!

I really appreciate all the help..it was a combination of all the pointers
and resources that helped me to investigate and resolve this. Thanks, all!

Patk
Post by Bob Barrows [MVP]
Post by PatK
Here is the entire script (keeping it simple). It is failling on the
oConn.Open. Also (to Roger), I do have IUSR_MYSYSTEM set as a the
user for anonymous access. What I have not been able to figure out
how to do is allow that user read/write access, as when I go to the
file directory security, as you noted, it will not allow me to add
that user.
What OS? If XP, have you turned off Simple File Sharing?
http://www.aspfaq.com/show.asp?id=2205
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Bob Barrows [MVP]
2008-01-17 18:56:15 UTC
Permalink
Post by PatK
Ultimately, it turned out to be a combination of things. I changed
the permissions to read/write to "everyone" on the access DB. This
resulted in a different error, that I was able to find a MS note on
http://support.microsoft.com/default.aspx/kb/315456
You got that error using the Jet OLE DB provider??? That's an ODBC
error.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
PatK
2008-01-17 21:57:01 UTC
Permalink
I am too big a noob in this area to even understand what you just said. I
may have changed lanes in mid-stream to get to where I did, including
changing access methods, as I attempted to find "anything" that would work.
The tip I found that made it work had a code snippet I leveraged, and it may
have switched it to an ODBC approach. Not really sure (yeah...I know that is
REALLY bad, but I am learning here....!) :-)
Post by Bob Barrows [MVP]
Post by PatK
Ultimately, it turned out to be a combination of things. I changed
the permissions to read/write to "everyone" on the access DB. This
resulted in a different error, that I was able to find a MS note on
http://support.microsoft.com/default.aspx/kb/315456
You got that error using the Jet OLE DB provider??? That's an ODBC
error.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
PatK
2008-01-17 22:00:02 UTC
Permalink
Here is where I ended up with the code:

<%
Dim oConn
Dim filePath
Dim strConnect
'--------------------------------------------------------------------
' Set the file path to the DB to be opened
'--------------------------------------------------------------------

filePath = Server.MapPath("_private/Assets.accdb")'

'--------------------------------------------------------------------
' Use this connect string if the database is Access 2007
'--------------------------------------------------------------------

strConnect = "PROVIDER=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=" & filepath

'--------------------------------------------------------------------
' Use this code if the database is Access 2003
'--------------------------------------------------------------------

'strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & filepath

'--------------------------------------------------------------------
' Open database using defined connection string
'--------------------------------------------------------------------

Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open strConnect

%>

This successful opened my Access 2007 DB.
Post by Bob Barrows [MVP]
Post by PatK
Ultimately, it turned out to be a combination of things. I changed
the permissions to read/write to "everyone" on the access DB. This
resulted in a different error, that I was able to find a MS note on
http://support.microsoft.com/default.aspx/kb/315456
You got that error using the Jet OLE DB provider??? That's an ODBC
error.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Bob Barrows [MVP]
2008-01-17 22:02:49 UTC
Permalink
That looks correct - no ODBC there.
Post by PatK
<%
Dim oConn
Dim filePath
Dim strConnect
'--------------------------------------------------------------------
' Set the file path to the DB to be opened
'--------------------------------------------------------------------
filePath = Server.MapPath("_private/Assets.accdb")'
'--------------------------------------------------------------------
' Use this connect string if the database is Access 2007
'--------------------------------------------------------------------
strConnect = "PROVIDER=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=" & filepath
'--------------------------------------------------------------------
' Use this code if the database is Access 2003
'--------------------------------------------------------------------
'strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & filepath
'--------------------------------------------------------------------
' Open database using defined connection string
'--------------------------------------------------------------------
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open strConnect
%>
This successful opened my Access 2007 DB.
Post by Bob Barrows [MVP]
Post by PatK
Ultimately, it turned out to be a combination of things. I changed
the permissions to read/write to "everyone" on the access DB. This
resulted in a different error, that I was able to find a MS note on
http://support.microsoft.com/default.aspx/kb/315456
You got that error using the Jet OLE DB provider??? That's an ODBC
error.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get
a quicker response by posting to the newsgroup.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Continue reading on narkive:
Loading...