Reputation: 101
I'm trying to follow along with my school project, and I set up IIS exactly as they recommended, including allowing 32 bit applications. However, despite trying this on 2 different computers from scratch it still doesn't work. I get the error message:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
/LEGO STORE/Program.asp, line 17
My code is as follows:
<%
dim con, rs, sql
Set con = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset")
con.open("DRIVER={Microsoft Access Driver (*.mdb, *.accdb)}; DBQ=" & Server.MapPath("Lego.accdb"))
sql = "SELECT * FROM Table1"
rs.Open sql, con
%>
I have no idea why it's not working, and I can't continue with my project until it is fixed. The files are hosted from my computer, rather than using a separate server. I checked the existing solutions, but they were for a different version of IIS and I don't know how different they are.
Upvotes: 0
Views: 2100
Reputation: 4638
There are two kinds of database associated with the MS Access program, JET (.mdb files) and ACE (.accdb files). The newer ACE format was introduced in 2007, long after Classic ASP had come to be regarded as "legacy", so pretty well any tutorial which deals with Classic ASP and Access will assume you're using a JET database. The ADODB driver for JET, which ships with IIS enabled versions of Windows, is 32 bit only. The ADODB driver for ACE is not included, you have to download and install it yourself. It does have a 64 bit version, and as far as I know it only has a 64 bit version.
I suspect that the most painless way to achieve what you want to achieve is to open Access and save a version of your database in the older .mdb format.
OLEDB connection strings are generally prefered to ODBC ones. In your case the connection string would be:
con.open("Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("Lego.mdb"))
www.connectionstrings.com is a good resource, (as well as being a very easy url to remember).
Upvotes: 0
Reputation: 878
if you're using IIS 7 or above, you'll also need to configure the app pool to allow 32 bit use:
Upvotes: 2