Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regarding transaction updates

 
ravindar dayachand
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 547
2
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
ravindar dayachand
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 547
2
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic