How best to manage connections
I am rewriting an application in Java. There will be 1-20 people accessing the DB. I don't yet know how many concurrent connections will need to be open. It could also be from 1-20.
Should:
1) Each person establish a single connection for the day and the connection remains open until they close down for the day?
2) Establish a connection pool with an estimate of connections needed overall and each person grabs a connection only when needed and returns to the pool when done?
3) Any other idea?
TIA
# 2
More information would help.
Why do you think that it matters with only 20 connections?
Are you writing a server or stand alone apps?
What is the actual physical layout? That impacts connection speed. And these days with a standard local lan connection speeds are very fast.
What is the volume? Is each person doing 10 or 10,000 transactions in a day?
What type of work is each person doing? Do you they have to build a massive interconnected structure that is stored or are they just updating a telephone number in one record?
If you are just curious rather than having a real need then you can use a connection pool regardless of circumstances.
# 3
Thanks for the responses.
DrClap: The comment regarding single vs multiple JVMs is something I have never considered. How does a single JVM service multiple users? This may force a method upon me.
jschell: My selection of concurrent connections is a 'best guess' for the immediate future.
The layout is actually a question I posed in the network section of the forums. I am still working through that.
As to whether or not this is a real need; few things are ever a real need. This is a want. I am rewriting a manufacturing system I currently use and wrote 10 years ago. My company has evolved and now needs to have the software match our business model. I have written small projects in Java, more for fun that practicallity, other than mobile programs I've written and use.
Thanks all,
TIA