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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cannot Access Database!!

Status
Not open for further replies.

ShotoCon

Technical User
Apr 27, 2008
14
US
Hi There,

Was developing a site on my old machine and have now transferred to my new machine which, unfortunately, has vista installed on it and so comes with IIS 7 and now my site will no longer connect to the database :(

Figured it was because the new machine has Access 2007 installed instead of Access 2003 - using an access db as this is just a quick bit of recap development for myself.

Tested using both connection string types (yes, i converted the database to an access 2007 db aslo) and still couldnt do it. Here is the code and the subsequent error messages i got, please note that these are test pages purely for the connections which aren't working:

Access 2003 stuff

Code:
<html>
<body>
<%
  Dim MyConnection
  Dim MyConnectionString
  Dim MySQLStatement

  MyConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=eBug.mdb;"

  MySQLStatement = "INSERT INTO Test Values('Test')"

  Set MyConnection = Server.CreateObject("ADODB.Connection")

  MyConnection.Open MyConnectionString
  MyConnection.Execute(MySQLStatement)
  MyConnection.Close()

  Response.Write("Record inserted successfully")

  Set MyConnection = Nothing
%>
</body>
</html>

and its output

Code:
Microsoft JET Database Engine error '80004005'

Unspecified error

/test2003.asp, line 15

Access 2007 stuff
Code:
<html>
<body>
<%
  Dim MyConnection
  Dim MyConnectionString
  Dim MySQLStatement

  MyConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;" & _
    "Data Source= eBug.accdb;"

  MySQLStatement = "INSERT INTO Test Values('Test')"

  Set MyConnection = Server.CreateObject("ADODB.Connection")

  MyConnection.Open MyConnectionString
  MyConnection.Execute(MySQLStatement)
  MyConnection.Close()

  Response.Write("Record inserted successfully")

  Set MyConnection = Nothing
%>
</body>
</html>

and its output

Code:
Microsoft Office Access Database Engine error '80004005'

Unspecified error

/test2007.asp, line 15

The local users all have full access control over the sites directory. Its running in the defaultAppPool and all that good stuff, everything is fairly standard and open, nothing fancy has been done with it as it will NEVER be opened to the public, this is solely dev practice for me because its been a while.

Anyone out there got any suggestions on what could be doing this? I have also posted this in the IIS 7 forum incase the problem lies there.

Any and all help appreciated.
 
should this:
MySQLStatement = "INSERT INTO Test Values('Test')"
be like this?
MySQLStatement = "INSERT INTO Test (field1, field2) Values('Test1', 'test2')"?
 
Hi, just a few quick replies

wvdba - in response to your reply, there is only one column in that particular table, its just for testing to be honest.

ChrisHirst - I know its cross posted, I stated that in my original post, the fact is im not sure that its an ASP or IIS issue.

ShotoCon
 
i use this connection string. i'm also using access db on my app:
DbLocation = "D:\Databases\
set objconn=Server.CreateObject("ADODB.Connection")
objconn.Provider="Microsoft.Jet.OLEDB.4.0;"
objConn.Mode = 3

objconn.Open DbLocation
you may also try this one for iis:
Server.MapPath("/SomeDirectory/")
 
Hi wvdba

Tried your way using the objConn settings and still get the unspecified error - alos, not too sure, but I think the Microsoft.Jet.OLEDB.4.0 provider is for Access 2003 databases (if is correct).

Another way I do (NOTE: this is connecting to a 2003 db, i have office 2007 installed on this machine hence why ive attempted it two different ways in my original post)

Code:
accessDb = "eBug.mdb"

        	myDSN = "DRIVER={Microsoft Access Driver (*.mdb)};"
        	myDSN = myDSN & "DBQ=" & server.mappath(accessDb)

        	Set dbConnection = Server.CreateObject("ADODB.Connection")
        	dbConnection.Open myDSN

a similar way to your own, returns the following error, which is slightly different

Code:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Microsoft Access Driver] Disk or network error.

still pointing to the connection opening line.

Hope this again helps to shed some light on what is quickly becoming a mystery to me!

ShotoCon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top