• Post Reply Bookmark Topic Watch Topic
  • New Topic

dead locks

 
raj joe
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do we avoid dead lock situations in database transactions (J2EE applications).How does JDBC and EJB help us.
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One thing you can do is to always use a DataSource to get your Connection, so avoid DriverManager.getConnection. The use of DriverManager.getConnection can cause a deadlock because in the server all DriverManager calls are class-synchronized (including many frequent calls that all drivers make) and JDBC drivers do a lot of synchronization internally. One long-waiting call can stop all JDBC work in the whole JVM and cause deadlocks.
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!