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

Problem with conn.setAutoCommit() method

 
Gayathri Chowduru
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[color=blue]Can someone please let me know, is there a chance for the transactions that gets hung up if I set the conn.setAutoCommit(false)???
Could you please let me know the importance of conn.setAutoCommit(true)??

Thanks,
Gayathri
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by "hung up"? If a client opens a transaction it then doesn't commit or rollback the transaction will remain until the database times it out. What side effects this causes in the application and database depends on which database you are using. In SQL Server for example, you are likely to see blocks appear.


Could you please let me know the importance of conn.setAutoCommit(true)??

What do you mean by importance? Are you asking what this method does or if you should use it?
 
Gayathri Chowduru
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The scenario is like,

For a transaction, more than 100 update statements gets executed. Our situation is like after executing around 50 or 60 update statements, few of the update statements are getting rolled back. But still the remaining update statements are successful only.
We follow the asynchronous framework and for each UPDATE STATEMENT, we create a separate thread for the execution. Are these rollbacks are because of not setting the conn.setAutoCommit(true) ??

That too why is it causing few Update Statements to rollback?? Not for all?? But still after these rollbacks, the rest of the update statements are successful only..

Thanks,
Gayathri
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

For a transaction, more than 100 update statements gets executed. Our situation is like after executing around 50 or 60 update statements, few of the update statements are getting rolled back. But still the remaining update statements are successful only.

In this case your 100 updates cannot be in a single transaction. If some are successfully committed and some rollback you must be using multiple transactions.


We follow the asynchronous framework and for each UPDATE STATEMENT, we create a separate thread for the execution. Are these rollbacks are because of not setting the conn.setAutoCommit(true) ??

Presumably whatever SQLException is preventing some updates will happen even with auto commit.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic