What are the benefits of using a JDBC connection pooling tool like DBCP or c3p0 ?
in case of a small CRUD application with one user, can we just create one connection session as a singleton ?
PS: I'm building a small javafx
application back-ended with tiny h2
database (5
tables).
From Jon Skeet's answer to What is the benefit of Connection and Statement Pooling?:
And the following, from Kent Boogaart's answer:
Creating connections is costly and it doesn't make sense to create a new connection for each transaction that might only take a few milliseconds. Managing database connections in a pool means that applications can perform database transactions in a way that avoid the connection creation time (The connections still need to be created, but they are all created at startup). The downside is that if all connections are in use, and another connection is required, the requesting thread will have to wait until a connection is returned to the pool.