Subject Re: [ib-support] object is in use
Author Claudio Valderrama C.
""goodieauk"" <andy@...> wrote in message
news:a6nqr7+t6u4@......
>
> The problem I have is that on some databases we will get `OBJECT IS
> IN USE' Metadata errors when changing or creating a FOREIGN KEY.
>
> I know there is an issue in that IB require exclusive access to the
> GDB if you are creating foreign keys ( Knowledgebase id81).
> However from what we can see we are creating only one connection,
> obviously we ensure only one users tries to connect to run the update.

Object in use is different than exclusive access to db is need or secondary
attachments cannot validate db.
Object in use means that in the same session, you did a select (probably an
update, delete, insert as the same effect) on a table or procedure that's
going to be altered. There are two solutions:
- You do a hard, explicit COMMIT. Autocommit and commit retaining don't
work. Most of the time a hard commit works.
- You play safe and detach. If there's no other attachment, this action
ensures the engine itself unloads the db from memory and frees the file
handles associated with it. Next time you connect, your metadata change
should succeed immediately.

A salute to a courageous person that still uses the Borland Database Enema.
:-)

C.
--
Claudio Valderrama C. - http://www.cvalde.com - http://www.firebirdSql.org
Independent developer
Owner of the Interbase® WebRing