Talk About Network

Google




Play Stock Market Games
Fantasy Stock Picking Contest

Data Bases > Pgsql Interfaces Jdbc > Re: Couple of p...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 1951 of 2010
Post > Topic >>

Re: Couple of preparedstatement bug suspects

by books@[EMAIL PROTECTED] (Kris Jurka) May 12, 2008 at 01:02 AM

Roy Smith wrote:
>     To get this control you shouldn't be using autocommit.  You should
>     turn that off and then rollback if you get a SQLException.  With
>     autocommit, the cats already out of the bag.
> 
> 
> Hmmm, not sure I agree but I'm happy to be persuaded. You're saying that

> a single JDBC call is *not* atomic in and of itself? As a computer 
> scientist I find that disturbing if it's true. It basically means that 
> running any JDBC session in autocommit mode is bogus, since individual 
> update statements become non-deterministic.

Well, in general autocommit isn't safe and neither is non-autocommit. 
If you get a network disconnect at just the wrong time (during commit), 
you can't tell what happened to your transaction.  You'll get a 
SQLException informing you your connection is gone, but did it commit or 
not?  You need two phase commit (XA) to be able to name and lookup in 
doubt transactions at a later date in case something bad happens.  In 
your case something odd is going on (which we may still be able to 
resolve), but is it worth moving every single application to XA to 
defend against these possibilities?  I don't think so.

> I do appreciate that where an executeUpdate is carrying out more than
> one database write there isn't much you can do about it.

Even in the single write case, there is some code in the JDBC driver and 
it must have some failure modes right?  What about an out of memory 
condition when trying to retrieve the server's response?  The server has 
committed it and the driver can't interpret that result.

> Nested transactions would be an answer, but of course there is no
> such thing.
> 

There are savepoints, but again I don't see how that's helpful in 
autocommit mode.



-- 
Sent via pgsql-jdbc mailing list (pgsql-jdbc@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc
 




 1 Posts in Topic:
Re: Couple of preparedstatement bug suspects
books@[EMAIL PROTECTED]   2008-05-12 01:02:32 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Fri Aug 8 12:33:48 CDT 2008.