This week's book giveaway is in the JDBC forum.
We're giving away four copies of Make it so: Java DB Connections & Transactions and have Marcho Behler on-line!
See this thread for details.
The moose likes JDBC and Relational Databases 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 Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Connection Pool" Watch "Connection Pool" New topic

Connection Pool

C Balajee

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() {
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

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

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

Joined: Oct 18, 2000
Posts: 25
Thanks Ajith and Peter.
I agree. Here's the link:
subject: Connection Pool
It's not a secret anymore!