Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Connection Pool

 
Vanitha Sugumaran
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 356
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks David for your detailed explanation.
Vanitha.
 
nabhilash
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
---------------------
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic