File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Regarding transaction updates Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Regarding transaction updates" Watch "Regarding transaction updates" New topic
Author

Regarding transaction updates

ravindar dayachand
Greenhorn

Joined: May 08, 2009
Posts: 14
How to maintain the JDBC call from java end

I make DB update query. Based on the return value it is confirmed whether the DB is updated or not.
Now i have a scenario where i make a update query and before the value is returned the db is physically disconnected how is this tracked, i mean i have updated the db and i dont have a return value on my db is updated or not how to handle such scenario.

Please help me with this question
Kumar Raja
Ranch Hand

Joined: Mar 18, 2010
Posts: 457

ravindar dayachand wrote:How to maintain the JDBC call from java end

I make DB update query. Based on the return value it is confirmed whether the DB is updated or not.
Now i have a scenario where i make a update query and before the value is returned the db is physically disconnected how is this tracked, i mean i have updated the db and i dont have a return value on my db is updated or not how to handle such scenario.

Please help me with this question



Carefully choosing the transaction demarcation would be helpful here. For eg, by enclosing your JDBC call and examining the response in one single transaction, could help you determine if the operation was successful or not. In the case of DB connection lost, most probably you would end up wth an exception and that is an indication for your rollback.


Regards
KumarRaja

ravindar dayachand
Greenhorn

Joined: May 08, 2009
Posts: 14
Thanks for the reply

But how could i demark in the below case

1 case :I want to update a account my query is succesfully executed and commited, while returning the successful message DB is disconnected

2 case :i update a account and i recieve a succesful message and then i run the commit statement but while returning the sucessfull comitted status the DB is disconnected.

How will i demark in these cases.

And regarding exception, what if the exception is throw after commit how would i know whether it is committed or rollback how to handle this scenario.I cannot think it as a rollback as the exception may be thrown after a succesful commit and before we recieve the status.
Kumar Raja
Ranch Hand

Joined: Mar 18, 2010
Posts: 457

ravindar dayachand wrote:Thanks for the reply

But how could i demark in the below case

1 case :I want to update a account my query is succesfully executed and commited, while returning the successful message DB is disconnected

2 case :i update a account and i recieve a succesful message and then i run the commit statement but while returning the sucessfull comitted status the DB is disconnected.

How will i demark in these cases.

And regarding exception, what if the exception is throw after commit how would i know whether it is committed or rollback how to handle this scenario.I cannot think it as a rollback as the exception may be thrown after a succesful commit and before we recieve the status.


Hmm, this is a quite interesting scenario and my suggestion below may not be a good one, but still I will put it forward. I wish some one in this forum could validate that and advice. I would be more curious to see if some one could contradict it and advise a better solution.

Case 1/Case 2

 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Regarding transaction updates
 
Similar Threads
Stateless session bean with CMT, sending JMS message on commit
Problem is Parallel Processing of Jobs in Java
Application Performance improvement
Syncronize AJAX requests: Client or Server Sync?
browser not refreshed