Skip to content

JNDI DataSource Factory (Tomcat, etc.)

Brett Wooldridge edited this page Jul 11, 2014 · 4 revisions

HikariCP includes a JNDI DataSource factory that can be used with Tomcat or other containers.

Example (Tomcat) configurations:

Driver-based:

<Resource name="jdbc/OracleHikari" auth="Container"
      factory="com.zaxxer.hikari.HikariJNDIFactory"
      type="javax.sql.DataSource"
      minimumIdle="5" 
      maximumPoolSize="10"
      connectionTimeout="300000"
      driverClassName="oracle.jdbc.driver.OracleDriver"
      jdbcUrl="jdbc:oracle:thin:@orcl_server:1521:orcl"
      dataSource.implicitCachingEnabled="true" 
      dataSource.user="user"
      dataSource.password="pwd" />

DataSource-based:

<Resource name="jdbc/OracleHikari" auth="Container"
      factory="com.zaxxer.hikari.HikariJNDIFactory"
      type="javax.sql.DataSource"
      minimumIdle="5" 
      maximumPoolSize="10"
      connectionTimeout="300000"
      dataSourceClassName="oracle.jdbc.pool.OracleDataSource"
      dataSource.implicitCachingEnabled="true" 
      dataSource.user="user"
      dataSource.password="pwd"
      dataSource.url="jdbc:oracle:thin:@orcl_server:1521:orcl"/>