It's not a secret anymore!*
The moose likes JDBC and the fly likes How to handle Transaction with JDBC which could not be rollbacked? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to handle Transaction with JDBC which could not be rollbacked?" Watch "How to handle Transaction with JDBC which could not be rollbacked?" New topic
Author

How to handle Transaction with JDBC which could not be rollbacked?

Leonardo Carreira
Ranch Hand

Joined: Apr 07, 2009
Posts: 489

Hi friends..

i use Swing + MySQL v5.0.81 +JDBC
is it possible the transaction could not be rollbacked?..
so what i have to do to handle it?..
do i have to rollback it manually?..
but i guess it is a hard work to rollback it manually..
is there any solution?

what kind of query which cause the query could not be rollbacked?..

Thanks in advance

Sorry, perhaps my english language isn't too good.. Prepare for SCJP 6, Please God help me.. ☼
References : [Java.Boot] [JavaChamp] [JavaPrepare]
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3838

what kind of query which cause the query could not be rollbacked?..


I haven't heard any query like that so far .....

SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Leonardo Carreira
Ranch Hand

Joined: Apr 07, 2009
Posts: 489

@Vijitha

Thanks for your reply..
what do you mean that all of transactions could be rollbacked?..

if there suddenly the electricity is turned off, does the transactions could be rollbacked also?..
i have just faced the problem, when the electricity is turned off suddenly (caused by the electricity provider).. and the table is crashed..
and the the transaction could not be rollbacked...

Does MySQL especially InnoDB storage engine can handle this case?..

Thanks in advance..



Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3838

when the electricity is turned off suddenly (caused by the electricity provider).. and the table is crashed..
and the the transaction could not be rollbacked...

Transactions are done within an active connection. Once you lost the connection to the DB server you are unable to perform the next operation(s).
Leonardo Carreira
Ranch Hand

Joined: Apr 07, 2009
Posts: 489

How about if the transaction is still in process..
example the tasks in the transaction like this, and the electricity turned off suddenly, does the transaction could be rollbacked?..




does in that case the transaction would be rollbacked automatically by MySQL?..

Thanks in advance
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

If you lose a connection you lose all associated resources, transaction included, which is the same as a rollback. If there has been no comit then the database will time it out (assuming you are using a MySQL db engine that supports transactions in the first place).



JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to handle Transaction with JDBC which could not be rollbacked?