Where do I have to place the JDBC driver for Tomcat’s connection pool?

The JDBC driver has to be visible to the same classloader as the data source factory itself. The data source factory library is placed in Tomcat’s own /lib folder and thus loaded by Tomcat’s “common” classloader. Your problem sounds much like that you dropped the JDBC driver in webapp’s /WEB-INF/lib. The webapp’s /WEB-INF/lib is invisible … Read more

JDBC Connection pooling using C3P0

With a pooled data source, the connections in the pool are not actually closed, they just get returned to the pool. However, when the application is shut down, those connections to the database should be properly and actually closed, which is where the final cleanup comes in. Incidentally, the c3p0 project is pretty much dead … Read more

Why does HikariCP recommend fixed size pool for better performance

I suggest you read this page and watch the attached video. The Oracle Performance Group demonstrates how an application with a pool of 96 connection easily handles 10,000 front-end users and 20,000 transactions per-second. PostgreSQL recommends a formula of: connections = ((core_count * 2) + effective_spindle_count) Where core_count is CPU cores, and effective_spindle_count is the … Read more

hibernate connection pool

<!DOCTYPE hibernate-configuration PUBLIC “-//Hibernate/Hibernate Configuration DTD 3.0//EN” “http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd”> <hibernate-configuration> <session-factory> <!– datasource config –> <property name=”connection.url”>jdbc:mysql://localhost:3306/db?useUnicode=true&amp;characterEncoding=UTF-8&amp;autoReconnect=true</property> <property name=”hibernate.dialect”>org.hibernate.dialect.MySQL5InnoDBDialect</property> <property name=”connection.driver_class”>com.mysql.jdbc.Driver</property> <property name=”connection.username”>user</property> <property name=”connection.password”>pass</property> <!– c3p0 config http://www.hibernate.org/214.html –> <property name=”connection.provider_class”>org.hibernate.connection.C3P0ConnectionProvider</property> <property name=”hibernate.c3p0.acquire_increment”>1</property> <property name=”hibernate.c3p0.idle_test_period”>60</property> <property name=”hibernate.c3p0.min_size”>1</property> <property name=”hibernate.c3p0.max_size”>2</property> <property name=”hibernate.c3p0.max_statements”>50</property> <property name=”hibernate.c3p0.timeout”>0</property> <property name=”hibernate.c3p0.acquireRetryAttempts”>1</property> <property name=”hibernate.c3p0.acquireRetryDelay”>250</property> <property name=”hibernate.show_sql”>true</property> <property name=”hibernate.use_sql_comments”>true</property> <property name=”hibernate.transaction.factory_class”>org.hibernate.transaction.JDBCTransactionFactory</property> <property name=”hibernate.current_session_context_class”>thread</property> … Read more

Is there any way to have the JBoss connection pool reconnect to Oracle when connections go bad?

Whilst you can use the old “select 1 from dual” trick, the downside with this is that it issues an extra query each and every time you borrow a connection from the pool. For high volumes, this is wasteful. JBoss provides a special connection validator which should be used for Oracle: <valid-connection-checker-class-name> org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker </valid-connection-checker-class-name> This … Read more

Am I Using JDBC Connection Pooling?

Assuming that it’s the BasicDataSource is from DBCP, then yes, you are using a connection pool. However, you’re recreating another connection pool on every connection acquirement. You are not really pooling connections from the same pool. You need to create the connection pool only once on application’s startup and get every connection from it. You … Read more