Re: questions regarding transactions - Mailing list pgsql-jdbc

From Fabian Zeindl
Subject Re: questions regarding transactions
Date
Msg-id 469612AE.5010401@xover.htu.tuwien.ac.at
Whole thread Raw
In response to questions regarding transactions  (Fabian Zeindl <fabian@xover.htu.tuwien.ac.at>)
List pgsql-jdbc
ok, thank you all ;)

fabian

Fabian Zeindl schrieb:
> Hi,
>
>  I'm using JDBC with transactions and I've got a couple of questions:
>
> 1) Am I supposed to do "myConn.rollback()" on error? What happens if I
> don't do it - will the transaction stay half-committed?! (I ask this,
> because rollback() can throw a SQLException, so it's not guaranteed to
> work, in my opinion).
>
> 2) When I use statements like (SELECT currval('somesequence')) in a
> jdbc-transaction, will it be atomic to? Will the sequence be decremented
> again when the transaction fails? Can I get wrong numbers, when there is
> another transaction which increments somesequence?
>
> 3) Is it sufficient to do setAutocommit(false) and set the
> transaction-level or do I have to call a statement like "START
> TRANSACTION" to properly start an transaction? (I found
> the latter example somewhere on the net.)
>
> Many thanks in advance and thank you for the wonderful driver
> fabian zeindl


Attachment

pgsql-jdbc by date:

Previous
From: "Diego Zanga"
Date:
Subject: Re: postgres jdbc into eclipse plugin (OID problems)
Next
From: Tom Lane
Date:
Subject: Re: postgres jdbc into eclipse plugin (OID problems)