Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Connection Pooling, anyone help me please!

 
Gustavo Santos
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello guys...
I'm having a bit of headache trying to figure out what's going on with my Connection Pooling since it's not working as it supposed to... it's been opening up to 150 connections for some reason which I don't know why... I've made it as simples as possible but the problem still remains.

Could anyone give me a hand on this one, Please?

 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I notice that your setupDataSource method creates a new ConnectionPool every time it's called. Correct me if I misunderstand the design, but shouldn't there just be one ConnectionPool which is accessed repeatedly?
 
Gustavo Santos
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:I notice that your setupDataSource method creates a new ConnectionPool every time it's called. Correct me if I misunderstand the design, but shouldn't there just be one ConnectionPool which is accessed repeatedly?

Exactly! so where do you think I should place it in a way that it opens only one ConnectionPool to be accessed repeatedly?

Thanks a lot for your help!

PS: I got this source from the Apache website and I thought it was right... I haven't made any changes in the code itself besides the selects and inserts.
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, if you have data that has to last longer than a method call, the usual simple way to deal with that in Java is to have class-level variables for the data. That's not specific to JDBC, though, that's just basic Java programming.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic