aspose file tools
The moose likes JDBC and Relational Databases and the fly likes How to handle connection failure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "How to handle connection failure" Watch "How to handle connection failure" New topic
Author

How to handle connection failure

V Patil
Ranch Hand

Joined: Oct 04, 2008
Posts: 36
I am using several insert statements in a method in Java.
If the connection fails in between I want to roll back the inserted rows.
I cant use con.rollback(), because there is no connection.
How to handle such situation?
Thanks in advance.
Ulf Dittmer
Rancher

Joined: Mar 22, 2005
Posts: 42954
    
  73
If no explicit commit has been given at the time the connection goes away, then the transaction is automatically rolled back by the server. The client doesn't need to do anything about it (apart form handling the client-side aspects).
V Patil
Ranch Hand

Joined: Oct 04, 2008
Posts: 36
Thanks a lottt for resolving my query.
Srikanth Nalam
Greenhorn

Joined: Feb 23, 2010
Posts: 20
just add to this, transaction auto commit should be false.


Thanks & Regards,
Srikanth Nalam.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to handle connection failure