-
ASP Database Access Error
I am attempting to access a database on the same server as my ASP page, and
I am getting an error that the File is not a valid format.
This is the error:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access Driver] Not a valid file name.
/c311ldcaltan/c312/a4/a4.asp, line 10
This is the code generating it:
<%
Dim objRec
Dim strSQL
Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection")
Session("AccessDBString") = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=URL=http://mars.cc.edu/c311ldcaltan/c312/fpdb/Products.mdb"
objConn.Open Session("AccessDBString")
Set objRec = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM Product"
set objRec = objConn.Execute(strSQL)
While Not objRec.EOF
Response.Write objRec("ProductName") & "<BR>"
objRec.MoveNext
Wend
objConn.Close
Set objRec = Nothing
Set ObjConn = Nothing
%>
Any suggestions on what could be wrong that it's generating the error?
thanks.
-
Re: ASP Database Access Error
You need to point to the file location in the form:
"C:\InetPub\WWWRoot\c311ldcaltan\c312\fpdb\Products.mdb".
--
Bradley Dean
Lorand <lorand@techie.com> wrote in message news:39590cce$1@news.devx.com...
>
> I am attempting to access a database on the same server as my ASP page,
and
> I am getting an error that the File is not a valid format.
>
> This is the error:
> Microsoft OLE DB Provider for ODBC Drivers error '80004005'
>
> [Microsoft][ODBC Microsoft Access Driver] Not a valid file name.
>
> /c311ldcaltan/c312/a4/a4.asp, line 10
>
> This is the code generating it:
> <%
> Dim objRec
> Dim strSQL
> Dim objConn
>
> Set objConn = Server.CreateObject("ADODB.Connection")
> Session("AccessDBString") = "DRIVER=Microsoft Access Driver
(*.mdb);DBQ=URL=http://mars.cc.edu/c311ldcaltan/c312/fpdb/Products.mdb"
>
> objConn.Open Session("AccessDBString")
>
> Set objRec = Server.CreateObject("ADODB.Recordset")
> strSQL = "SELECT * FROM Product"
> set objRec = objConn.Execute(strSQL)
>
> While Not objRec.EOF
> Response.Write objRec("ProductName") & "<BR>"
> objRec.MoveNext
> Wend
>
> objConn.Close
> Set objRec = Nothing
> Set ObjConn = Nothing
> %>
>
> Any suggestions on what could be wrong that it's generating the error?
>
> thanks.
>
-
Re: ASP Database Access Error
If I needed to change the form of the request, I would be getting a "File
Not Found" error. Excepting the fact that I dont KNOW that particular form
of the path, I'm getting an Invalid File Type error, it's finding the file
just fine.
"T. Bradley Dean" <Bradley.Dean@InfoDish.com> wrote:
>You need to point to the file location in the form:
>"C:\InetPub\WWWRoot\c311ldcaltan\c312\fpdb\Products.mdb".
>
>--
>Bradley Dean
-
Re: ASP Database Access Error
This is the line of code I was given sample for that method:
"DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("ClassSample.mdb")
& ";"
It works on the sample page, but if I import it into my page and change the
filename to mine, it gives me a file not found, i'll try it with your string
Thanks
>I'm not sure that's right. I don't think you can point to databases that
>way. I may be wrong, but I say try it.
>
>I've never used this before, but try this for the path:
>
>Server.MapPath("\") & "\c311ldcaltan\c312\fpdb\Products.mdb"
-
Re: ASP Database Access Error
I'm not sure that's right. I don't think you can point to databases that
way. I may be wrong, but I say try it.
I've never used this before, but try this for the path:
Server.MapPath("\") & "\c311ldcaltan\c312\fpdb\Products.mdb"
--
Bradley Dean
Lorand <lorand@techie.com> wrote in message news:395912c0$1@news.devx.com...
>
> If I needed to change the form of the request, I would be getting a "File
> Not Found" error. Excepting the fact that I dont KNOW that particular form
> of the path, I'm getting an Invalid File Type error, it's finding the file
> just fine.
>
> "T. Bradley Dean" <Bradley.Dean@InfoDish.com> wrote:
> >You need to point to the file location in the form:
> >"C:\InetPub\WWWRoot\c311ldcaltan\c312\fpdb\Products.mdb".
> >
> >--
> >Bradley Dean
>
-
Re: ASP Database Access Error
Lorand,
I usually skip the ODBC and go directly with the OLEDB Provider specifically
for Jet :
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("\db1.mdb") & ";"
You can use whatever provider/driver you like, but you need the leading
slash as in my example when using Server.MapPath
I like Server.MapPath vs. the hardcoded path Bradley originally provided,
because if you're host or Server admin moves the directories around you're
up a creek.
-JasonL
Lorand <lorand@techie.com> wrote in message news:39591728$1@news.devx.com...
>
> This is the line of code I was given sample for that method:
> "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" &
Server.MapPath("ClassSample.mdb")
> & ";"
>
> It works on the sample page, but if I import it into my page and change
the
> filename to mine, it gives me a file not found, i'll try it with your
string
>
> Thanks
>
> >I'm not sure that's right. I don't think you can point to databases that
> >way. I may be wrong, but I say try it.
> >
> >I've never used this before, but try this for the path:
> >
> >Server.MapPath("\") & "\c311ldcaltan\c312\fpdb\Products.mdb"
>
-
Re: ASP Database Access Error
Lorand,
This is most likly a security issue; eventhough the error doesn't say it.
Check out http://support.microsoft.com/support.../Q183/0/60.ASP
Titled:
INFO: Troubleshooting Guide for 80004005 & Other Error Messages
I think the first thing to try is create a System DSN and try to make the
connection. If you still get the error, most likely it will be the security
settings on the folder that the database is in. Make user iuser_yourservername
has rights.
Hope this helps
Don
"Lorand" <lorand@techie.com> wrote:
>
>I am attempting to access a database on the same server as my ASP page,
and
>I am getting an error that the File is not a valid format.
>
>This is the error:
>Microsoft OLE DB Provider for ODBC Drivers error '80004005'
>
>[Microsoft][ODBC Microsoft Access Driver] Not a valid file name.
>
>/c311ldcaltan/c312/a4/a4.asp, line 10
>
>This is the code generating it:
><%
>Dim objRec
>Dim strSQL
>Dim objConn
>
>Set objConn = Server.CreateObject("ADODB.Connection")
>Session("AccessDBString") = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=URL=http://mars.cc.edu/c311ldcaltan/c312/fpdb/Products.mdb"
>
>objConn.Open Session("AccessDBString")
>
>Set objRec = Server.CreateObject("ADODB.Recordset")
>strSQL = "SELECT * FROM Product"
>set objRec = objConn.Execute(strSQL)
>
>While Not objRec.EOF
> Response.Write objRec("ProductName") & "<BR>"
> objRec.MoveNext
>Wend
>
>objConn.Close
>Set objRec = Nothing
>Set ObjConn = Nothing
>%>
>
>Any suggestions on what could be wrong that it's generating the error?
>
>thanks.
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks