What is connection pooling?how to implement connection pooling?

Showing Answers 1 - 3 of 3 Answers

chap22

  • Feb 27th, 2006
 

hi

many applications need to connect the databse for retrieving or any other purpose, there needs to be a connection estd, when lot of such requests are made the burden on server aswellas network increases,

thereby, set up a pool where the connections are at one place, so every time db connnection needs to be estd,

when a req is made to pool or any object which holds all the connections to provide a connection

  Was this answer useful?  Yes

srinivas.g

  • Jul 25th, 2006
 

connectionpool is a setof readily availble connection objects.

this concept is very useful .because creating data base connection and destroying connection is quite unusual process ,it degrades the performance of application.client comes and make a request to business method ,so it might involved database data ,then connction object simply used,and after execution of business method ,connection object shouldbe  returned to the pool.this is implicit service provided by application server vendors,so we can happily use it.

  Was this answer useful?  Yes

ajaykjha

  • Oct 24th, 2006
 

Creating a Connection object is one of the most expensive operations in database programming so we use connection pooling.When the application starts, a certain number of Connection objects are created and stored in a pool. When a database client, such as servlet, needs to use a Connection object, it does not create the object but instead requests one from pool. When the client is finished with it, the Connection object is returned to the pool.To use the Connection pooling feature in the javax.sql package, you need to connect to the data source using the javax.sql.DataSource interface. The sample code is:Context context = new InitialContext();DataSource ds = (DataSource) context.lookup("jdbc/myDB");Connection con = ds.getConnection(user, password);

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions