This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JDBC and the fly likes Connection Pool Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Connection Pool" Watch "Connection Pool" New topic
Author

Connection Pool

C Balajee
Greenhorn

Joined: Oct 18, 2000
Posts: 25
I would like to create a class for pooling my connection to my oracle database
I have generated a factory Class named 'ConnectionPool'
public class ConnectionPool {
static Pool p = new Pool();

public ConnectionPool() {
super();
}
}
which will create an Object of the 'Pool' Class and then
I have used this Object to retreive my connection.
The 'Pool' class is as follows
public class Pool {
static Connect1 c = new Connect1();
static Connection con;

public Pool()
{
con = c.connectToOracle();
}
}
The Connect1 class is working fine and returning a valid connection to me.
I would like you to Go through the code and Suggest me enhancements. I also want to create say 20 Connections and use them one after the other. (In the above program there is only one Connection and I'm just pasiing the refernce to my utility programs.)
Please do help
Thanks in advance
C Balajee
Peter Tran
Bartender

Joined: Jan 02, 2001
Posts: 783
C,
JDBC 2.0 extension supports ConnectionPooling. Read this article to learn how.
-Peter
Ps. Please check JavaRanch's naming policy.
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
I am moving this thread to JDBC forum.
------------------

Ajith Kallambella M.
Sun Certified Programmer for the Java2 Platform.


Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
C Balajee
Greenhorn

Joined: Oct 18, 2000
Posts: 25
Thanks Ajith and Peter.
C.Balajee
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Connection Pool