• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Regarding transaction updates  RSS feed

 
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
 
Ranch Hand
Posts: 558
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: 558
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

 
You've gotta fight it! Don't give in! Read this tiny ad:
Programmatically Create PDF Using Free Spire.PDF with Java
https://coderanch.com/wiki/703735/Programmatically-Create-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!