I want to connect to a MySQL database from a standalone application. There is no application/web server.
This page suggests that I should use DriverManager to create the connection. However this page suggests that connections created from DriverManager cannot be pooled.
However connection pooling is a must for me because the application uses various threads to write to the database concurrently, so closing/recreating connections is not optimal.
Which DataSource implementation should I use for this purpose? I looked at MysqlConnectionPoolDataSource but I am not sure if it actually implements a connection pool. I also looked at the Tomcat DataSource which I am sure implements a connection pool but I am not sure if it can be used outside Tomcat.
When I close the standalone application what should I do to release the connections/pool properly?
EDIT: It looks like the Tomcat DataSource is usable from standalone application, so I am going to use it. It also has a close method which I assume will release the connections.