3

I'm developing a WebApp and it can be accessed 24/7, so it doesn't really have a moment when I can say: "Finally I'm not using the connection pool anymore, I'm going to shut it down".

I've read (here at SO: BoneCP correct usage) that I should use the shutdown method if I'm sure that I'm not using connections anymore, but that's not my case.

So, is there any problem if I don't shutdown the pool?

Community
  • 1
  • 1
Clawdidr
  • 577
  • 1
  • 8
  • 25

1 Answers1

0

The answer is to allow the connection pool to manage database connections. Any decent connection pool will provide some configuration options that will enable you to customize connection retention policies, min/max pool sizes, connection testing / verification, etc. . .

I looked at your link (BoneCP correct usage) and I would suggest that you configure the connection pool at the web container level as a JNDI DataSource, and not within your application. Your application would then access then access the connection pool via JNDI. There are number of benefits to this approach. Here a few:

1) your app doesn't know or care whether it's using a connection pool or a regular jdbc connection. The latter is helpful during development testing, as startup time faster and memory usage is smaller. 2) your app doesn't need to the the database connection details (e.g. jdbc url, username, and password). Allowing you to use a common WAR file for all deployments. 3) configuration and tuning of the pool can be done without need for rebuilding and redeploying your application.

Community
  • 1
  • 1
Tom Drake
  • 527
  • 5
  • 11