An End to Database Locks!

Locked!

Writing ArcObjects code and using an Access personal geodatabase will result sooner or later in an error along the lines of “Cannot aquire a schema lock because of an existing lock.” Spending hours going through code, making sure objects are disposed of and that all connections closed often makes very little difference. It becomes apparent some of the problems lie deeper than customised code when the same errors occur when using ArcMap or ArcCatalog without any modifications.

I have been using Unlocker, a freeware program, to solve these issues when developing with ArcObjects (or just using ArcMap..). Once installed a simple right click on an ldb or mdb file can remove any file locks, and your code is free to run again. It works with any Windows file or folder so is a useful program to have around even without geodatabases.

More reviews and an alternative download site can be found here.

Unlocker

Advertisement

2 Responses to An End to Database Locks!

  1. Eric R. says:

    This is great! But, how would I release all schema locks programmatically, using VBA?
    Is there a method such as schemaLock.ReleaseAll?

    Thanks, –Eric

    • geographika says:

      As any application accessing the database would itself cause a lock on the .mdb file, I don’t think it would be possible with VBA code.
      You can use code from http://support.microsoft.com/kb/198755/EN-US/ to find a list of users connected to the database and if they are in a suspect state.
      Failing all else you could write code to delete the .ldb file, but this may cause more problems than it solves.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: