in which condition we have to use connection pool of jdbc?
anyone explain to me in detail?
thanx in advance
Pool is a more general concept and is very widely used in highly distributed and scalable applications. As far as jdbc is concerned, assume that a database server which serves your application with data has a maximum of say 20 connections which means that 20 database requests can be processed by the database simultaneously one through each connection. If the database server is overwhelmed woth more requests (> 20) at the same time, it is highly likely that a few requests could not be serviced because of the connection not being available and you may be getting a connection timeout exception.
Futher, there is a significant overhead involved in creating a new jdbc connection every time a request is to be serviced. It's much more efficient to create a list of jdbc connections (< 20) and store them in an aggregate data structure such as Vector, array etc and get them whenever required. But care has to be taken to esure that the connection pool is synchronized so that the same connection is not issued until it is returned to the pool by the caller.