Subject Re: [Firebird-Java] Transaction concurrency
Author Jim Starkey
Gerevich Janos wrote:

> I am using firebird(1.5.1) with Jaybird JDBC(1.5.5) with autocommit ON
>
> I am inserting records that all have a timestamp
>
> What I want to do, is that noone can insert a record, whose timestamp
> isn't disjunct with all inserted timestamps (take table reservations:
> you can't reserve a table from 20 to 23 if that table is already
> reserved from 18 to 20:30. These reservations are not disjunct, because
> they coincide from 20 to 20:30)
>
There isn't a straightforward way to do what you want. The problem is
that a transaction sees that state of the database when it started;
record inserted a committed in overlapping transactions are not
visible. You might be able to cobble something together from the funny
transaction modes, but they aren't theoretically sound and you're likely
to have undetectable race conditions. Autocommit is going to make
things worse, not better.

I suspect you will need to learn a bit more about how concurrency and
transaction control actually work, the drop back and think some more
about how your application is designed.