How do I unlock or overwrite my Access database?

The following article explains how to unlock an Access database. As a normal part of ODBC operation, your database file is locked by the ODBC connection. There is a trick you can use to unlock the database temporarily. You can write a page to query a non-existent column in an existing table in your database. This will temporarily unlock the database so that you can overwrite the file. Since the file will be re-locked quickly, especially if other pages are accessing the database, it is best to rename or delete the old database before uploading the new one. As soon as you upload the new database and run a good query, normal ODBC operation will resume.

There are a few things you can do to maximize the success of the unlock page:

  1. Make sure that no other pages are executing queries on the database. If a valid query is run right after your invalid query, the database will be locked again.
  2. Since the database can be re-locked quickly, rename the .mdb file as soon as you run the invalid query. Then you can upload the new database and not worry about it locking again before you have a chance.
  3. This trick often requires some patience - if it doesn't work at first, try it again a few times. Also, you may want to wait a few minutes and then try. You may want to rename, disable, or move any pages that query the database to prevent them from re-locking it.
  4. If all else fails, upload another copy of the database with a different name. Email support@hostmysite.com and we will adjust the DSN.

© 2015 HostMySite