wood burning stoves 2.0*
The moose likes JDBC and the fly likes Connection Pooling, anyone help me please! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Connection Pooling, anyone help me please!" Watch "Connection Pooling, anyone help me please!" New topic
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: 18541
    
    8

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: 18541
    
    8

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Connection Pooling, anyone help me please!
 
Similar Threads
How to control no. of JDBC Connections in Tomcat!!!
Regarding Connection pool
Objects used to create a connection
Can I create connection pooling with data sources using sybase driver(jconn2.jar)?
JDBC Connection Pooling Framework