Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Connection Pool

 
C Balajee
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
C,
JDBC 2.0 extension supports ConnectionPooling. Read this article to learn how.
-Peter
Ps. Please check JavaRanch's naming policy.
 
Ajith Kallambella
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am moving this thread to JDBC forum.
------------------

Ajith Kallambella M.
Sun Certified Programmer for the Java2 Platform.
 
C Balajee
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ajith and Peter.
C.Balajee
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic