Reputation: 1399
I am having to work in classic ASP for a small job. I am trying to get the site running on my computer to test. I am running Windows 7 and IIS 7.
I get an error when running from local host and on checking the logs I get the error: 80004005 | Could_not_find_file_'c:\inetpub\wwwroot\sc\website\data\si.mdb'
My code is like so
dim objConn
dim objRS
set objConn = Server.CreateObject("ADODB.Connection")
objConn.Provider="Microsoft.Jet.OLEDB.4.0"
Set objRS = Server.CreateObject("ADODB.Recordset")
objConn.Open("c:/inetpub/wwwroot/sc/website/data/si.mdb")
This is the exact path to the file however. Anyone know how I can access this? Is the code wrong or are there IIS settings I need to set?
I do not have any version of Office installed, would that cause a problem?
I have tried lots of different paths and provider settings but none have worked.
Edit The code I am working on actually didn't have any connection string details in the code but the person said it still worked on thier computer as a friend setup the test environment.
He doesn't recall how his friend setup but said " What I remember from watching him, he connected to the database through Data Sources (ODBC) because as you said in the code theres no direct path as its using a 'global something' (dont know the right term)."
Upvotes: 0
Views: 2912
Reputation: 14308
You could try using Process Monitor to see exactly which file is not being found or it is being caused by a permissions issue.
Also, although using forward slashes instead of backslashes isn't usually a problem, you may want to try changing that in case it makes any difference.
If you're using an x64 version of windows, JET is not supported in this mode, though you can get around it by configuring IIS to run x32 applications. To do this, run the following at the command line:
cscript.exe adsutil.vbs set W3SVC/AppPools/Enable32BitAppOnWin64 "true"
iisreset
The second command may not be required, but I'm guessing that you would probably need to restart IIS before this change takes effect.
It sounds like the code was previously set to use a global DSN, hence the lack of a path in the connection string, though there should have still been some kind of connection details (like the DSN name).
Upvotes: 1
Reputation: 25346
Why does your string say: "c:/inetpub/wwwroot/sc/website/data/si.mdb"
instead of the normal windows path "c:\inetpub\wwwroot\sc\website\data\si.mdb"
Also, you could go to Control Panel->Administrative Tools->Data Source (ODBC) and create a new named DSN under the System tab. Name it si for example and make sure the type is access, give it the right path to the access db and then your code would just be:
dim objConn
set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open("si")
Upvotes: 0
Reputation: 6780
I answered a potentially related question the other day. Are you running 64-bit windows 7? If so there is absolutely NO Jet support for x64 OSes. In a real .NET application you could simply recompile the application with x86 as the target. But in your case I am not sure of the solution.
Seth
Upvotes: 0
Reputation: 33474
Your connection string doesn't look right to me.
See if this helps.
EDIT: Do you have JET oledb provider installed?
EDIT2: Check for existence of oledb provider with help from this question.
How to check if an OLEDB driver is installed on the system?
Upvotes: 0
Reputation: 3464
This may be a permissions issue.
An easy way to check would be to give full access to everyone for the directory the file is in.
Upvotes: 1
Reputation: 83709
Maybe you could use the Server.MapPath function as used here http://www.aspwebpro.com/tutorials/asp/dbconnectionopen.asp
Upvotes: 0