I'm building a socket server with Java. Each new socket connection launches a new thread which will need a connection to a MySQL server.
Currently I have a new connection for every thread but would like to change to a connection pool so that I can more effectively recycle connections.
However, the default size of this pool seems to be of 5 connections. I'm currently handling more than 100 clients and 5 connections won't be enough. All of the documentation I've found mention the different servers (Tomcat, JBoss, GlassFish, etc) and how to place the value in their XML configuration files.
Since I'm not using any of these, I can't find how to set the max pool size
value. I would also like to avoid third party libraries for this project (such as Apache Commons).
An exception to that would be the MySQL connector for Java (found here: http://dev.mysql.com/usingmysql/java/)
The only possible reference I've found is env.put(JNDIPooledSource.MAX_POOL_SIZE, 500);
but I don't believe that's correct.
Thanks for your help.
Context
andDataSource
classes injavax.naming
andjavax.sql
respectively to create a pool but can't seem to set the size of it. – Andre