Results 21 to 40 of 58
Thread: Connection Pool
- 06-14-2011, 10:06 AM #21
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
No.
It's a package (a jar in this case) that you pass a configuration to.
If this were a webapp then the webapp would do it for you (assuming you'd given the correct info to, eg, Tomcat).
Most of the examples you are getting are probably for webapps, since that's the place it makes the most sense to use them. Many desktop apps wouldn't bother.
- 06-14-2011, 10:20 AM #22
Senior Member
- Join Date
- Apr 2010
- Location
- Philippines
- Posts
- 580
- Rep Power
- 4
Oh! ok. I am developing desktop application in a server/client (just small LAN), so it does not matter if I do not use connection pool? And database/application performance will not be that bad as what shows in tutorials?
Many thanks for the info.
- 06-14-2011, 10:22 AM #23
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
Is the server going to hold the db access code?
If so (and there are mutliple clients/threads) then a pool makes sense.
- 06-14-2011, 10:34 AM #24
Senior Member
- Join Date
- Apr 2010
- Location
- Philippines
- Posts
- 580
- Rep Power
- 4
Pardon, but what is db access code?
There are multiple clients that will connect to database (on server) at the same time.
- 06-14-2011, 10:44 AM #25
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
Code that accesses the db.
But it sounds like your server is the db, so that doesn't apply.
I would start by not using a pool and grab a connection as and when.
Should the grabbing of a connection be a problem (ie it takes a while to get a connection due to network factors) then you can look into a pool. You should be able to easily swap out your getConnection code if you've written your system in a modular way.
- 06-14-2011, 10:46 AM #26
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,385
- Blog Entries
- 7
- Rep Power
- 17
When people rob a bank they get a penalty; when banks rob people they get a bonus.
- 06-14-2011, 10:53 AM #27
Senior Member
- Join Date
- Apr 2010
- Location
- Philippines
- Posts
- 580
- Rep Power
- 4
The first time of connection take time i think 5-10 seconds. Then after that connection responses fast.
Only when I test about 200000 records it respond almost a minute so I 'page' the record by 30 and it works fine.
I would like to discuss it but I have to go. I will be back tommorrow and update what I learn on tutorials.
Many many thanks... :)
- 06-14-2011, 10:57 AM #28
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
- 06-14-2011, 11:57 AM #29
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,385
- Blog Entries
- 7
- Rep Power
- 17
- 06-14-2011, 12:22 PM #30
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
Excuuuuse me...

And I really don't like these smileys...
- 06-14-2011, 12:27 PM #31
Senior Member
- Join Date
- Apr 2010
- Location
- Philippines
- Posts
- 580
- Rep Power
- 4
So the client will request from the server if there is an available connection from the pool, if there is available then server will return an open connection. Will I code it myself or the tool for connection pool (.jar file like Apache DBCP) will do this requesting to the server?
Thanks
- 06-14-2011, 12:36 PM #32
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,385
- Blog Entries
- 7
- Rep Power
- 17
- 06-14-2011, 12:51 PM #33
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
You haven't given us much information on your architecture.
By "server" do you mean that there's some java there or do you mean "the database"?
If the latter then you won't have a connection pool on the server since it's the database.
If the former then you should have a pool.
- 06-15-2011, 02:27 AM #34
Senior Member
- Join Date
- Apr 2010
- Location
- Philippines
- Posts
- 580
- Rep Power
- 4
The "server" is the database, so I will not have to use connection pool, right?
Connection pool is advisable to use when I develop Web Applications? What are the other situations that connection pool is applicable?
Thank you.
- 06-15-2011, 09:30 AM #35
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,385
- Blog Entries
- 7
- Rep Power
- 17
Web applications have nothing to do with it; you use a Connection pool if you have to handle more than one database requests that have (almost) no relation with each other; if more than one client want your server to access a database a Connection pool comes in handy because the server can't open as many connections as there are clients and the server doesn't know when those clients make their requests. So your server keeps a couple Connections in a pool and uses them when it needs one.
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 06-15-2011, 09:33 AM #36
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
Connection pools are most often used on servers, like webapps.
They are also used on desktop apps (ie on the client) where a connection might take a while to create (depending on network) and you want to make use of a connection pool's reconnecting code, without having to write your own. But then the overhead (not sure, haven't really looked into that side of things) might not be worth it. The connection pool keeps its connections alive by essentially making a call on them every so often on a separate thread.
- 06-15-2011, 09:36 AM #37
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
- 06-15-2011, 09:37 AM #38
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,385
- Blog Entries
- 7
- Rep Power
- 17
When people rob a bank they get a penalty; when banks rob people they get a bonus.
- 06-15-2011, 09:39 AM #39
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,385
- Blog Entries
- 7
- Rep Power
- 17
When people rob a bank they get a penalty; when banks rob people they get a bonus.
- 06-15-2011, 09:47 AM #40
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
Blame eejit users who don't bother logging off.
A database has limited resources, and clogging them up with twits who aren't doing anything is a waste...:)
Oh yes, quite agree.
Exposing the database like that is poor architecture...and can lead to the problem above of a database running out of available connections. And eejit users.
It also means if you move the db or change it in anyway you then have to update all the clients.
Similar Threads
-
Access to app server db connection pool
By metazone in forum JDBCReplies: 3Last Post: 03-26-2011, 03:45 PM -
Any alternative to c3p0 connection pool library
By gane in forum JDBCReplies: 2Last Post: 12-15-2010, 06:11 AM -
using snaq.db for connection pool
By Li Xiao in forum JDBCReplies: 1Last Post: 08-08-2010, 10:28 AM -
Using Database connection pool
By amsagara in forum Advanced JavaReplies: 0Last Post: 08-11-2009, 12:44 PM -
connection pool for db2
By paty in forum JDBCReplies: 1Last Post: 08-06-2007, 02:43 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks