Anders Moen Posted March 5, 2007 Share Posted March 5, 2007 I just copied my last post from the category general: Set oConn = Server.CreateObject("ADODB.Connection")sConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & Server.MapPath("\UserName\db\dbname.mdb") & ";" & _ "Persist Security Info=False"oConn.Open(sConnection)'...oConn.Close You replace Username with your actual user name. Do you have your database in the db folder of your account? It will not work anywhere else.Did you upload an existing database or use their database manager to create a new one? I made one online at them. Look at my code now:<%Set oConn = Server.CreateObject("ADODB.Connection")sConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & Server.MapPath("c:\sites\content\a\n\d\andersmoen\db\anders.mdb") & ";" & _ // This is my path to the database. "Persist Security Info=False"oConn.Open(sConnection)'...oConn.Close%> Here's the error message I get: Server.MapPath() error 'ASP 0172 : 80004005' Invalid Path /a/n/d/andersmoen/index.asp, line 11 The Path parameter for the MapPath method must be a virtual path. A physical path was used.And it says my path is at my control panel: c:\sites\content\a\n\d\andersmoenand with database it'll be c:\sites\content\a\n\d\andersmoen\db\news.mdbI seriously start hating Microsoft for making it so difficult now:P Link to comment Share on other sites More sharing options...
pulpfiction Posted March 5, 2007 Share Posted March 5, 2007 As the error says "The Path parameter for the MapPath method must be a virtual path. A physical path was used" you must a relative or virtual path to map to a physical path. so try changing it to......"Data Source=" & Server.MapPath("andersmoen\db\anders.mdb") & ";" &Link: http://www.w3schools.com/asp/met_mappath.asp Link to comment Share on other sites More sharing options...
Anders Moen Posted March 5, 2007 Author Share Posted March 5, 2007 Microsoft VBScript compilation error '800a03ea' Syntax error /a/n/d/andersmoen/index.asp, line 14 "Data Source=" & Server.MapPath("\andersmoen\db\anders.mdb") & ";" &--------------------------------------------------------------------^Here's my site if you wanna see yourself: http://andersmoen.brinkster.net/ Link to comment Share on other sites More sharing options...
aspnetguy Posted March 5, 2007 Share Posted March 5, 2007 should be "Data Source=" & Server.MapPath("\andersmoen\db\anders.mdb") & ";" & _ drop the comment, besides you use ' for comments in VB not // Link to comment Share on other sites More sharing options...
aspnetguy Posted March 5, 2007 Share Posted March 5, 2007 it is not MS that makes it hard. I found that Brinkster makes it harder than it should be and plus PHP makes it very easy because they wrote the mysql library around database interaction. There isn't a built in db library for ASP. Link to comment Share on other sites More sharing options...
Anders Moen Posted March 5, 2007 Author Share Posted March 5, 2007 I don't understand a thing now...Look:I tried with absolute root path: (c:\sites\content\a\n\d\andersmoen\db\anders.mdb), and I've tried with only \andersmoen\db\anders.mdb and andersmoen\db\anders.mbd but I get error message every time. "Data Source=" & Server.MapPath("c:\sites\content\a\n\d\andersmoen\db\anders.mdb") & ";" & _gives this error message:Server.MapPath() error 'ASP 0172 : 80004005' Invalid Path /a/n/d/andersmoen/index.asp, line 12 The Path parameter for the MapPath method must be a virtual path. A physical path was used. "Data Source=" & Server.MapPath("andersmoen\db\anders.mdb") & ";" & _gives this error message:Microsoft JET Database Engine error '80004005' 'C:\Sites\content\a\n\d\andersmoen\andersmoen\db\anders.mdb' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides. /a/n/d/andersmoen/index.asp, line 17 Link to comment Share on other sites More sharing options...
pulpfiction Posted March 5, 2007 Share Posted March 5, 2007 If you read the server,mappath in w3schools, then there is an explanation about using a "/" and not using it in Server.MapPath("\andersmoen\db\anders.mdb") When I tested it in localhost, If you start with a "/" then path is c:\inetpub\wwwroot and concatenates the path we mention insideabove.Incase if your page is in folder in wwwroot and if given without "/" it gives path path including that folder i.e the path of the page.c:\inetpub\wwwroot\subfolder\If without "/" it returns a path relative to the directory of the .asp file being processedso make sure you print the path and see if its correct. Link to comment Share on other sites More sharing options...
Anders Moen Posted March 5, 2007 Author Share Posted March 5, 2007 I'm pretty sure it's backslashes because in my control panel at Brinkster.com it says:Absolute Root Path: c:\sites\content\a\n\d\andersmoen Link to comment Share on other sites More sharing options...
aspnetguy Posted March 5, 2007 Share Posted March 5, 2007 plus you cannot have an absiolute path in Server.MapPath.If you are going to use an absolute path try this "Data Source=c:\sites\content\a\n\d\andersmoen\db\anders.mdb;" & _ Link to comment Share on other sites More sharing options...
pulpfiction Posted March 5, 2007 Share Posted March 5, 2007 In the error, asp page is looking for the database file in this location, this guess is not the correct path.'C:\Sites\content\a\n\d\andersmoen\andersmoen\db\anders.mdb'If you currect .asp page is inside "andersmoen" folder then try,Server.MapPath("db\anders.mdb") Link to comment Share on other sites More sharing options...
Anders Moen Posted March 5, 2007 Author Share Posted March 5, 2007 Nice! I didn't recognise that it tried to reach a folder called andersmoen with db inside when I used andersmoen\db\anders.mdbI got 0 errors now (CHECK SELF Link to comment Share on other sites More sharing options...
pulpfiction Posted March 5, 2007 Share Posted March 5, 2007 did you use Server.MapPath("db\anders.mdb") or the absolute path to connect successfully, [just for my clarification, im still slightly confused with "/" in server.mappath] Link to comment Share on other sites More sharing options...
Anders Moen Posted March 5, 2007 Author Share Posted March 5, 2007 I wrote db\anders.mdb only Link to comment Share on other sites More sharing options...
Anders Moen Posted March 5, 2007 Author Share Posted March 5, 2007 Okay, what's wrong with this code then? <%Set oConn = Server.CreateObject("ADODB.Connection")sConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & Server.MapPath("db\news.mdb") & ";" & _ "Persist Security Info=False"oConn.Open(sConnection)'...oConn.Close%> I just get this error message:Microsoft JET Database Engine error '80004005' Unrecognized database format 'C:\Sites\content\a\n\d\andersmoen\db\news.mdb'. /a/n/d/andersmoen/index.asp, line 18 Link to comment Share on other sites More sharing options...
pulpfiction Posted March 5, 2007 Share Posted March 5, 2007 may be one of these errors....http://support.microsoft.com/kb/306269 Link to comment Share on other sites More sharing options...
aspnetguy Posted March 5, 2007 Share Posted March 5, 2007 nothing appears wrong. I found back int he day when I used Brinkster that it would sometimes take a while before the asystem recognized a new database I created. After a while it would just start to work. Link to comment Share on other sites More sharing options...
Anders Moen Posted March 5, 2007 Author Share Posted March 5, 2007 But I've had this for like 2 weeks now =/ Link to comment Share on other sites More sharing options...
pulpfiction Posted March 5, 2007 Share Posted March 5, 2007 I've never used brinkster before, hope there's a helpdesk you can contact about this issue... Link to comment Share on other sites More sharing options...
aspnetguy Posted March 5, 2007 Share Posted March 5, 2007 try their support forum. This is a very common issue with brinkster there is probably a dozen answers tot eh same problem you are having. Link to comment Share on other sites More sharing options...
Anders Moen Posted March 5, 2007 Author Share Posted March 5, 2007 Ah, okay.You don't know about better ASP hosts then? Which include a database too? Link to comment Share on other sites More sharing options...
Anders Moen Posted March 7, 2007 Author Share Posted March 7, 2007 Okay, I just tried the code again <%Set oConn = Server.CreateObject("ADODB.Connection")sConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & Server.MapPath("db\anders.mdb") & ";" & _ "Persist Security Info=False"oConn.Open(sConnection)'...oConn.Close%> but now I just get this message: Microsoft JET Database Engine error '80004005' Unrecognized database format 'C:\Sites\content\a\n\d\andersmoen\db\anders.mdb'. /a/n/d/andersmoen/index.asp, line 17But at least it's almost good then, or? Anybody got any ideas for why it's like this then? =/ Link to comment Share on other sites More sharing options...
pulpfiction Posted March 7, 2007 Share Posted March 7, 2007 Found this page related to 80004005 Errors, thought might help....[http://tutorials.aspfaq.com/8000xxxxx-errors/80004005-errors.html] Link to comment Share on other sites More sharing options...
Anders Moen Posted March 7, 2007 Author Share Posted March 7, 2007 Thanks, I read it all through but I still don't know what to do =/ Link to comment Share on other sites More sharing options...
justsomeguy Posted March 7, 2007 Share Posted March 7, 2007 Contact your host. They can help you quicker and easier then anyone on here can. Link to comment Share on other sites More sharing options...
Anders Moen Posted March 8, 2007 Author Share Posted March 8, 2007 I've already done that, and they just sent me a link to the site with different types of connections, but I didn't get anyone of them to work =/But I will try again later today/tomorrow and then I'll tell you if it works this time. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now