Connecting to an Access Database Problem

Discussion in 'Databases' started by mattaub, Jun 9, 2011.

  1. Lets say I run the following connection string:

    Set objConn1 = Server.CreateObject("ADODB.Connection")
    objConn1.Open ("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("\database\mydatabase.mdb;Pwd=removed;"))

    set recordset1 = Server.CreateObject("ADODB.Recordset")
    recordset1.ActiveConnection = objConn1

    ---

    If I run that code and the database IS in that location, everything is fine.

    However, if the database IS NOT in that location and I run the code, I get the following error:

    Provider error '80004005'
    Unspecified error

    ---

    Now, I realize that if the database is not there, the code is going to throw an error. But, if I put the database there and run the code again, it will keep on throwing the code for several minutes, up to several hours until it some how resets itself.

    I know the solution to the problem is to simply have the database in the correct location when the code is run. But sometimes I am in the process of uploading the database, and I accidently try to access it. Then the code is thrown and I don't have access the database for a few hours.

    I've had this problem on other servers too. This problem happens EVERY time I try to connect to a database that is not there. Any ideas?
     
  2. Ray

    Ray

    The error...

    Provider error '80004005'
    Unspecified error

    Typically means that the Access database got stuck in a hung state. Maybe in this case the connection string to the Access database which is an object itself got hung. Not really sure because the error is not very descriptive and can be caused by a numerous things. Its just from my experience the Access database itself is hanging.
     
  3. Thanks Ray.

    Is there a way to "un hang" the database, or do i just have to wait until it does it itself?
     
  4. Ray

    Ray

    Recycling the application pool should release it. You can initiate an application pool recycle from within your control panel to Site Manager/Recycle App Tool
     
  5. Thanks Ray,

    It worked.

    -Matt
     

Share This Page