Subject Re: [firebird-support] Re: locking a database
Author Ann W. Harrison
martinknappe wrote:
>> i'm new to firebird and databases in general ...
> i was only thinking that if you have several write-authorised users
> simultaneously connected to a database and user 1 for instance
> modifies an entry in transaction 1 while user 2 deletes the exact same
> entry in transaction 2, you would end up with inconsistent data..

No. That's one of the reasons databases exist - they allow
multiple users to change the same data at the same time without
stepping on each other. If two updates conflict, one will get
an error.
>
> so, in the course of one transacition, all other transactions are
> blocked from modifying by default or do i have to configure that
> myself? if so, is it a server-wide configuration that applies for all
> registered databases or do i have to configure that (e.g. via isql)
> for each and every database?

If you change a record (insert, update, or delete), no other
transaction can change the same record (update or delete) until
your transaction completes. That's true of all multi-user
databases. Different databases handle the problem in different
ways - Firebird creates multiple versions of records so a reader
can continue to see the old version while writers create new
versions. If there's a new version of a record that your
transaction can't read, you can't change that record. There's no
configuration required.


> i'm working on a database app for my college degree and for now i'm
> still doing everything (client-app and firebird) on my own machine but
> it's all supposed to be ported at the end to client-server and i was
> starting to worry about how this all behaves when multiple clients are
> connected to one database on a remote host...

There's nothing to worry about, but you might pick up a book on
databases - they're an interesting subject.


Regards,


Ann