Thanks Jeanne Boyarsky, I am already aware of connection pooling and have used it in some projects, but recently in one of the interviews the interviewer asked me how to implement the connection pooling, if I have to write the customized connection pool for some application. So I was more interested in writing a customized connection pool application.
As you know already that in Connection Pooling we have the pool of connections made. Different users use the connection and then give it back to the client. So to develope your own connection pool you will make a connection manager class as singlton and use any Collection object to store the connections.
You will define getConnection,releaseConnection methods in that class. which will give the connection from the pool and take back the connection and insert into the pool.
Major issue to consider in this regard is that you should implement your class as thread safe. If different users request for a connection at the same time and pool is empty then users should wait until a connection is released by another users.
You will define how many connections will you provide and there are different approaches in this regard. You can initialize all the required connections and store then in pool or you will initialize connection on demand.