All application servers must provide a pooling mechanism for database connections. The creation of a database connection from within your application is an expensive operation and can take anywhere between 0.5 and 2 seconds. Thus, application servers pool database connections so applications and individual threads running inside applications can share a set of database connections.
The process is as follows: A thread of execution needs to access a database, so it requests a connection from the database connection pool, it uses the connection (some execution of a SELECT or UPDATE or DELETE statement), and then it returns the connection back to the connection pool for the next component that requests it. Because J2EE applications support many concurrent users, the size of your connection pools can greatly impact the performance of your application. If 90% of your requests need database connections and you want to be able to support 500 simultaneous users, you will need a substantial number of connections in your connection pool. Note that when factoring in think time, you will probably need far fewer than 500 connections, but you will need quite a few.
Each application uses the database differently, and thus tuning the number of connections in your connection pool is application-specific. It is important to keep in mind that in practice tuning, JDBC connection pool size is one of the factors with the highest impact on your application's overall performance.