Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ASP cannot open Access database

Posted on 2007-04-03
4
Medium Priority
?
355 Views
Last Modified: 2012-06-27
I just installed IIS on a Vista laptop and cannot open an Access database from ASP using LocalHost. Here’s the code:

dim cn, dbname
dbname = "C:\tempx\op.mdb"
set cn = server.createobject("ADODB.Connection")
cn.provider = "microsoft.jet.oledb.4.0"
cn.properties("data source") = dbname
Response.Write "Here 1 <BR>"
cn.open
Response.Write "Here 2 <BR>"

(I have unchecked “Friendly Error Messages”, but still cannot see the actual error message), but here is what I get when I run the code:

Here 1
An error occurred on the server when processing the URL. Please contact the system administrator

I am guessing that the error is generated when it tries to create the “LDB” file during the open operation, so I have temporarily opened up permissions as follows:
Regarding folder Permissions for C:\ tempx, I have given Full Control to Everyone as well as the Anonymous Login account.
Regarding file Permissions for C:\ tempx\op.mdb, I have given Full Control to Everyone as well as the Anonymous Login account.
I also gave Full Control to Everyone as well as the Anonymous Login account for the folder that the ASP program is in.

What else do I need to do to allow an ASP program to be able to open the Access database?
0
Comment
Question by:lee88
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 

Author Comment

by:lee88
ID: 18842373
I figured out how to get the detailed error message. Here's what I get now:

Here 1
Microsoft JET Database Engine error '80004005'
Unspecified error
/kiosk/ASPtest.asp, line 9
0
 
LVL 4

Expert Comment

by:eivo
ID: 18843072
iis is a pain when you try and extract error messages out of it.

but it looks to me like you havent got a proper connection string

i.e.
cn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("C:\tempx\op.mdb")

simply create the object, then use that to open the connection

if you're having problems using that, you might want to define an infinately easier to manage DSN on your server and use the connection string:

adoCon.Open "DSN=whateverthedsnis"

to define a DSN you need to go to Control Panel -> Data Sources or Control Panel -> Administrative Tools -> Data Sources
0
 

Author Comment

by:lee88
ID: 18844193
eivo: Thanks for the suggestions. I tried your connection string and got the same error. Regarding setting up a DSN, when I get to the "ODBC Data Source Administrator" window, on the User tab, I selected "MS Access Database" and click "Add", then gave my new DSN a name (Test_mdb) and pointed it to the mdb file.

Here's the code:

dim cn, dbname
set cn = server.createobject("ADODB.Connection")
Response.Write "Here 1 <BR>"
cn.open "DSN=Test_mdb"
Response.Write "Here 2 <BR>"
Response.End

 Here's the result:

Before fso.CopyFile
After fso.CopyFile
Here 1
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
/kiosk/ASPtest.asp, line 12

Did I leave something out?
Also, do I do this under the "User DSN" tab as opposed to the "System DSN" or "Fiile DSN" tabs?
0
 
LVL 4

Accepted Solution

by:
eivo earned 2000 total points
ID: 18844517
it needs to be done under systemDSN in order for you to be able to connect from iis
you also should make sure that you use the correct driver for access,

also make sure that you have not set a username and password on your access database (it's not usual)

connectionstring in this event would be
"DSN=test_mdb;UID=username;PWD-password"

you will then need to create a recordset to output your data,
i.e.

dim recordset
dim query
set recordset = server.createobject("ADODB.Recordset")
query = "SQL QUERY HERE"
recordset.open query, cn  'then add whatever cursors or pointers you fancy, e.g. 3,3

and you're ready to roll

hope this is useful to you
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question