| Author |
Is this possible to create more than one connection in a java application?define loss and benefit.
|
Rd Dari
Ranch Hand
Joined: Feb 22, 2010
Posts: 194
|
|
Hi ,
I have a question that Is it possible to create more than one database connection in one application if it is then what are loss and benefit of it?
And in my opinion it is possible but there is no benefit instead it will allocate more memory.I want to exact answer.
Thanks!
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
|
Yes, very possible and frequently done (have a search for "Connection Pool"). You would use more then one connection if your application supports more than one user.
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
Rd Dari
Ranch Hand
Joined: Feb 22, 2010
Posts: 194
|
|
OK but in which condition I have more than one user in one application. I think it can be from a single connection.....
please explain it in detail.
Thanks in advance!
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
When the application is a server based application.
Even without multiple users, you may want to have background processes using the database asynchronously. Turn the question on its head: why do you think it is a good thing to restrict an application to one connection?
|
 |
Rd Dari
Ranch Hand
Joined: Feb 22, 2010
Posts: 194
|
|
OK right, but I's thinking that is wasting of memory to using connection more than one time .
Thanks! for your opinion and good answer.
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26144
|
|
|
That would only be a problem if memory was more constrained than time. Memory is cheap so this isn't often the case.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
 |
|
|
subject: Is this possible to create more than one connection in a java application?define loss and benefit.
|
|
|