| Author |
Connection Pooling, anyone help me please!
|
Gustavo Santos
Ranch Hand
Joined: Jan 22, 2009
Posts: 40
|
|
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
Bartender
Joined: Oct 14, 2005
Posts: 16487
|
|
|
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
Joined: Jan 22, 2009
Posts: 40
|
|
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
Bartender
Joined: Oct 14, 2005
Posts: 16487
|
|
|
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.
|
 |
 |
|
|
subject: Connection Pooling, anyone help me please!
|
|
|