views:

748

answers:

6

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)."

A: 

Maybe you could use the Server.MapPath function as used here http://www.aspwebpro.com/tutorials/asp/dbconnectionopen.asp

John Boker
i tried that and still get the same error :(
dean nolan
+1  A: 

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.

Bela
I still get the exact same error even after setting full permissions to everyone :(
dean nolan
A: 

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.
http://stackoverflow.com/questions/113860/how-to-check-if-an-oledb-driver-is-installed-on-the-system

shahkalpesh
I tried that but get the same error. Though when I tried the workgroup setting I got a different error saying |Could_not_find_installable_ISAM But I do not think that's the settings I want either.
dean nolan
How would I check? I don't have Office installed so not sure if thats the problem. I have VS2008 Pro though so maybe that comes with the driver?
dean nolan
See if this http://stackoverflow.com/questions/113860/how-to-check-if-an-oledb-driver-is-installed-on-the-system helps.
shahkalpesh
So I done a search for JET and found the DLL on my machine, can't recall the exact filename off hand.So Im sure that isn't the problem
dean nolan
A: 

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

Seth Spearman
I'm on 32 bit so that probably isn't it
dean nolan
A: 

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")
Michael Pryor
i tried both ways, forward slashes and back slashes and that's possibly just the last one I tried.
dean nolan
+1  A: 

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).

Mun
I used process monitor and it shows that the file doesn't exist. Even though it clearly does. It is 32 bit I'm using.I can't believe I'm still trying to solve this 2-3 hours later, what a waste of a day!How would I go about setting this up without the connection string details?He originally had con.Open si.mdb "" ""
dean nolan
I know you have checked...but I think it is a permissions issue as implied here.Seth
Seth Spearman
I'm inclined to agree with Seth, it still sounds like a permissions problem. Have you tried renaming the file and moving it to a different location? I'd recommend putting it in the root, eg. c:\db.mdb and trying to connect to it there (keeping process monitor open as well to monitor things).
Mun
I'm going to accept this answr as it shows a lot of the steps that you can take to fix this. I can't delete the question :(I am ashamed to say.....it was a spelling mistake!!!
dean nolan