views:

100

answers:

1

Which of these approaches is better: connection pooling or per-thread JDBC connections?

A: 

Connection Pooling for sure and almost always.

Creating new database connection is very costly for performance. And different DB engines (depending on licensing or just settings) has different maximum number of connections (sometimes it even 1, usually not more then 50).

The only reason to use Per-Thread connections is if you know that there are certain small number of persistent threads (10 for example). I can't imagine this situation in real world.

Roman