Skip to content

Instantly share code, notes, and snippets.

@akari0624
Last active September 14, 2018 18:20
Show Gist options
  • Save akari0624/13142a5cc58d8849ecaf6a1959abe9ee to your computer and use it in GitHub Desktop.
Save akari0624/13142a5cc58d8849ecaf6a1959abe9ee to your computer and use it in GitHub Desktop.
hikariCP JNDI datasource xml configuration
<?xml version="1.0" encoding="UTF-8"?>
<!-- (webapp)/META-INF/context.xml -->
<!-- use hikari connectionPool to init multiple dataSource -->
<!-- dependencies: HikariCP-3.1.0.jar, mssql-jdbc-6.4.0.jre8.jar, ojdbc6.jar they both implements JDBC 4.0-->
<Context>
<Resource
name="jdbc/hikariOracle"
auth="Container"
type="javax.sql.DataSource"
factory="com.zaxxer.hikari.HikariJNDIFactory"
dataSourceClassName="oracle.jdbc.pool.OracleDataSource"
dataSource.user="user1"
dataSource.password="user1password"
dataSource.url="jdbc:oracle:thin:@127.0.0.1:1521:RA"
maximumPoolSize="10"
minimumIdle="5"
connectionTimeout="300000"
closeMethod="close"
/>
<Resource
name="jdbc/hikariSQLServer"
auth="Container"
type="javax.sql.DataSource"
factory="com.zaxxer.hikari.HikariJNDIFactory"
dataSourceClassName="com.microsoft.sqlserver.jdbc.SQLServerDataSource"
dataSource.user="user2"
dataSource.password="user2password"
dataSource.databaseName="dbName"
dataSource.url="jdbc:sqlserver://127.0.0.1:1433"
maximumPoolSize="10"
minimumIdle="5"
connectionTimeout="300000"
closeMethod="close"
/>
</Context>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment