Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JdbcTemplate and Multi-threading  RSS feed

 
Yile Ku
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am creating a single JdbcTemplate and passing it into several threads to update multiple records (a thread per record) in a database. Eventually I get an exception saying the data base is closed.
Whats the right way to do this?
M-
 
T Mishra
Ranch Hand
Posts: 108
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This might be happening.
Concurrent update -> dirty reads -> JdbcTemplate throws SqlException -> JdbcTemplate closes connection
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!