This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Connection Pool Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Connection Pool" Watch "Connection Pool" New topic
Author

Connection Pool

Vanitha Sugumaran
Ranch Hand

Joined: Apr 11, 2001
Posts: 356
Hi,
When should we use connection pool? I have a program to get the user info and insert it into the database, do I have to use connection pool for this task?
Thanks,
Vanitha.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

A connection pool is useful when you have multiple threads that need short-lived database connections, as in web applications. In this situation, the time and effort required to create and release a database connection is more than the work that is done with the connection.
Therefore we gather a pool of shared connections so that we don't have to constantly open and close database connections.
So.... if you have a client-server app where the server controls database resources (which it should) and they are constantly being created and destroyed, make an object pool. If you have a general app where you only need a single connection on a single thread or you use a connection for long periods and don't create them very often, a connection pool may not be worth the trouble.
(imho etc )
Dave.
SAFROLE YUTANI
Ranch Hand

Joined: Jul 06, 2001
Posts: 257
Dave, I want to elaborate on this topic. I am currently writing an application that uses Oracle's JDBC 2.0 connection pool framework. If I encapsulate the Oracle connection pool details into a singleton class with 2 methods, namely getConnection() and releaseConnection(), do you think I would run into synchronization issues when connections are requested? I dont see why since there is only 1 logical instance of the pool anyway, so it would make sense to get connections from a static factory.
SAF
Vanitha Sugumaran
Ranch Hand

Joined: Apr 11, 2001
Posts: 356
Thanks David for your detailed explanation.
Vanitha.
nabhilash
Greenhorn

Joined: May 10, 2001
Posts: 8
Dear Friends

We are using Oracle8i Enterprise Edition Release 8.1.5.0.0. Here and there i found that Advanced JDBC features are supported (like conn pooling /data source usage etc ) only by 8.1.1.6 version onwards. How far this is true.
Regards
Abhilash
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

"nabhilash",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp .
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in again with a new name which meets the requirements.
Thanks.
Dave
jay net
Greenhorn

Joined: Nov 27, 2001
Posts: 2
write now i am using jdk 1.1 and i have a jdbc1.0 directory. Now I downloaded jdk1.3 to get jdbc2.0 and its features. But i don't see jdbc directory. How to replace my old with new. also in old i have classes11.zip etc. they are in my classpath. now what do i need to replace with. Please help.

Originally posted by David O'Meara:
A connection pool is useful when you have multiple threads that need short-lived database connections, as in web applications. In this situation, the time and effort required to create and release a database connection is more than the work that is done with the connection.
Therefore we gather a pool of shared connections so that we don't have to constantly open and close database connections.
So.... if you have a client-server app where the server controls database resources (which it should) and they are constantly being created and destroyed, make an object pool. If you have a general app where you only need a single connection on a single thread or you use a connection for long periods and don't create them very often, a connection pool may not be worth the trouble.
(imho etc )
Dave.

nabhilash
Greenhorn

Joined: May 10, 2001
Posts: 8
Ok once jdk1.3 installed means all java2 features is there . Only thing is that make sure all jar files with jdk kit in ur classpath. U have to download classes12.zip froom oracle site and same has to be there in classapath.
regards
sandhya menon
Ranch Hand

Joined: May 22, 2001
Posts: 37

Is this is true. I doubt but i have seen same quries on other sites also . Is there any one to confirm
-----------------------
We are using Oracle8i Enterprise Edition Release 8.1.5.0.0. Here and there i found that Advanced JDBC features are supported (like conn pooling /data source usage etc ) only by 8.1.1.6 version onwards. How far this is true.
---------------------
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Connection Pool
 
Similar Threads
Connection pool in struts framework
how to use connection pools in wl6.1
Regarding Connection pool
what connection pooling is better?
database connetion