Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

connecting to Access 2007 on a windows 7 64 bit machine

Status
Not open for further replies.

zombieprogrammer

Programmer
Jan 16, 2010
2
0
0
GB
I have recently obtained a new 64bit machine running windows 7. I have set up IIS and installed office 2007.
I then built a simple database called test.mdb containing one table called test. The database is saved in C:\inetpub\
I have also created an asp page called test.asp and also saved in C:\inetpub\ to connect to the database. Test.asp is about as simple as can be has the following code

Code:
--------------------------------------------------------------------------------
<%@ Language=VBScript %>
<% Option Explicit %>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Test</title>
<SCRIPT language="JavaScript" type="text/JavaScript" src="../js/GeneralFunctions.js"></SCRIPT>
</head>
<body>


<%

Dim cnnLogin
Dim rstLogin
Dim strSQL

strSQL = "SELECT * FROM test"
Set cnnLogin = Server.CreateObject("ADODB.Connection")

cnnLogin.Open("DRIVER={Microsoft Access Driver (*.mdb), *.accdb};" _
& "DBQ=" & Server.MapPath("test.accdb"))

Set rstLogin = cnnLogin.Execute(strSQL)

If Not rstLogin.EOF Then

response.write "hello world"

End If

' Clean Up
rstLogin.Close
Set rstLogin = Nothing
cnnLogin.Close
Set cnnLogin = Nothing

%>

</body>
</html>
--------------------------------------------------------------------------------


When I try to open the page in localhost I get an error message as follows;

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

I have perservered for over a week now and am sick of the sight of Google. I have finally given in and decided to ask for help. Could anyone please put me out of my misery and tell me how to connect to my database please?
 
You say you built a test database called test.mdb yet the Server.MapPath refers to test.accdb - make sure it looks at the correct filename before trying anything else.

John
 
Thanks John.

I appear to have stumbled on what may be the solution to my problem, here:

Using Classic ASP with Microsoft Access Databases on IIS 7.0 and IIS 7.5

It seems I need to change a setting in the application pool of IIS to enable 32 bit applications. Anyway changing it meant that the previoulsy rejected asp page was now accepted.

I had my suspiscions that it was an issue surrounding 64 bits / 32 bits as investigating the initial error message led me to this discussion;

Data source name not found and no default driver specified

which highlights the fact that there are two ODBC managers in Windows 7. (Frankly, most of that discussion went straight over my head)

I don't know if I have inadvertantly fixed my original problem by altering this application pool setting or created further problems for myself elsewhere but I'll keep my fingers crossed. End result I can connect to a database and display the results on a local web page. Happy days.

Thank you for your help in this matter. :grin:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top