Access Database Connection Problem

Discussion in 'Databases' started by mattaub, Mar 1, 2011.

  1. Here is my code to open my access database:

    Set objConn = Server.CreateObject("ADODB.Connection")
    connStr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("\database\data.mdb;Pwd=removed;")
    objConn.Open(connStr)
    set recordset = Server.CreateObject("ADODB.Recordset")
    recordset.ActiveConnection = objConn

    and to close the access database:

    objconn.close
    set objConn = Nothing

    I have used that exact code for years so I don't think its a coding issue

    Here is the problem:

    The Access Database opens and closes fine on the first request. But when I try to open and close again, I get Provider error '80004005' Unspecified error.

    If 20 to 30 seconds pass and I request the database a connection is possible.

    This condition is happening when I try to open and close the database multiple times in the same script, or refresh the page.

    Thanks,
    Matt
     
  2. Ray

    Ray

    Last edited by a moderator: Oct 14, 2015
  3. Thanks I will give it a shot
     
  4. Hi,

    I replaced my connection string with:


    Set objConn = Server.CreateObject("ADODB.Connection")
    connStr = ("Provider= Microsoft.ACE.OLEDB.12.0;Data Source=" & Server.MapPath("\database\data.mdb;Pwd=removed;"))
    objConn.Open(connStr)
    set recordset = Server.CreateObject("ADODB.Recordset")
    recordset.ActiveConnection = objConn

    Now I get the following error:

    Microsoft Access Database Engine error '80004005'

    Could not find installable ISAM.

    Thanks,
    Matt
     
  5. Ray

    Ray

    The connection string should work. How is your Access database setup? Can you set it up with a password requirement?
     
  6. I'm not sure what you mean with how my Access database is set up. I do have a password in the connection string.

    I am using Access 2000. I also haven't had this problem before. Everything worked fine in the past.
     
  7. Correction

    Correction - Im using an Access 2003 database.
     
  8. Ray

    Ray

    Try this instead and see if this will work.

    "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("\database\data.mdb;Pwd=removed;"))

    If possible can you setup the Access database to not require a password to be passed through it?
     
  9. That connection string didn't work either.

    However, i tried my original connection string again, and now it works fine. The connection string has worked fine for the past month, but it didn't work today for a few hours.

    Thanks for you help and quick responses,

    Matt
     
  10. Glad you got it worked out.
     

Share This Page