Friday 26 October 2012

JDBC CONNECTION POOLING

JDBC CONNECTION POOLING




Def of JDBC Connection Pooling : Each JDBC Data source has a pool of JDBC  Connections that are created when the data source is deployed at server start up

---> Application use a connection from the pool then return it when finished using the connection.





Q)  What is Connection Pool ?



A) ----> Connection Pool is used to cache (speed up) the database connections maintained so that connections can be reused for further request

    -----> Opening and Maintaining a database connection for each user.





Usage of JDBC CONNECTION POOLING: 


----> Here we have to use the datasource to handle the connections 
----> Means without this we cannot communicate to any database
-----> It provides a communicator or mediator between enduser and database
-----> If we send the request to JDBC or any database it will first goes to datasource 
-----> In this datasource it will store a pool of connections to provide the necessary request to any database
-----> DataSource handle the JDBC connections to forwards the request to any database
-----> In this they will store some pool of connections to handle 
----->  It will allots some time or interval for that connection means connection TimeOut
-----> If this particular Connection Pool TimeOut is over it wil discarded from that pool
-----> Again the other user will use that same connection without using the new connection.
-----> Means here datasource is using the reusability concept.
-----> Reusability means once if we write any program or any code it is not necessary to write the code again and again 
-----> Any body can use that program it saves time and memory of your system.


There are some connection timeouts used in JDBC

Reap Time : Max time to fetch data from database 180 seconds.
----> It Priority is  Lowest timeout 
-----> If connection is not used it should closed.



Unused TimeOut : If Max timeafter which far unused connections 
----> As soon as Con() query is executed it calls method connection Close().
----> If not called it should close in 1800 seconds.
----> means it will check for unused connections in database if timeout of that interval is over it will discarded from connection pool.




Aged TimeOut : If we give anytime here connections will be removed whether connection is in use or not 
----> Irrespective of connection is used or not use it should discarded that connection.
---> means here the time of that particular connection has been aged 
----> means the time alloted for that particular connection has been over so it will discarded from that pool 

---->  Its Priority is Highest TimeOut



0 comments:

Post a Comment