Subject Re: [firebird-support] Hibernate, alter table and single user
Author Ann W. Harrison
jeffrobertsky@... wrote:
>
> On the Hibernate site, they list as a known issue:
>
> "If you are altering tables you should be in single user mode. This
> can be achieved by running gfix -shut. It's also sufficient to have
> only one database connection open (eg. immediately after starting the
> application). If more than one connection is open, you will see
> errors like "table is in use". To restart your database use gfix -
> online."
>
The note is overly broad. Defining foreign key constraints requires
single user access to the database. Other metadata changes don't,
generally. You can't drop a table or an index that someone else is
using - and generally can't drop a table or index if someone else has
used it in a connection that's still active.

> I looked at 'gfix -shut' and I think what they are saying is that you
> can shut down your database to see if there are other users using it?

Do you have a copy of Helen's book? I use mine all the time -
invaluable source of information.

gfix -sh[ut] {-at n | -tr n | -f n}

-at n disables new attachments and shuts down in n seconds if all
attachments have finished

-tr n disables new transactions and shuts down in n seconds if all
transactions have finished

-f n forcibly shuts down in n seconds, terminating transactions with
prejudice.


>
> But to address the problem itself, what does "you should be in single
> user mode" mean? The paragraph above makes sense if only the admin
> is altering tables on rare occasions, but I originally started
> looking into this because the Hibernate *example code* makes 'alter
> table' calls and it's failing.

What is the error - metadata updates can fail for a variety of reasons,
not all related to concurrent activity.
>
> And if do use Firebird in single user mode with Hibernate, does that
> make Hibernate less useful in any way?

Umnn... without knowing what Hibernate does, I really can't say.


Regards


Ann