Subject | Re: AW: [Firebird-Java] Do I need to commit every transaction if I'm using jaybird? |
---|---|
Author | Roman Rokytskyy |
Post date | 2005-02-02T11:14:14Z |
> Really? I disagree.As I wrote, I have no example for now.
> SQL statements are ment to be atomic.
> They work or they are rolled back by some exception.True. But work of a single statement. Procedure is also considered a single
statement. All this is controlled by internal savepoints.
> But since you maintain the driver, you should know better.JDBC specification requires driver to commit the transaction. There is no
condition "commit if ok, rollback if exception".
> So, can you explain what you ment and give any example?Sure, theoretical example would be:
Statement stmt = con.createStatement();
stmt.execute("INSERT INTO bla VALUES(1); INSERT INTO bla VALUES(2); UPDATE
bla SET id = 2");
If Firebird would accept such compund statements, both statements are
executed atomically within the client-initiated transaction. Now let's
assume that we have unique constraint defined for field ID. First two
inserts succeed, last update will fail (table still contains records with
ID=1 and ID=2). However, transaction is committed from the client.
But currently Firebird does not support this (for example, DB2 does), so
nothing to worry for now (but maybe there is some wierd example that I do
not know).
Roman