There is aready a open source utils for creating Db pooling. Have a look at this
URL.
However, if you want to create one your own,
Create a set of connection using
JDBC and store it using some collection classes. whenever new connection is requested, use it from the existing one. This will reduce connection creation time.