Opinion part:
First off, I will say that it's probably not necessary to use HikariCP with a Java EE app server. From what I've read, HikariCP is a great connection pool and makes sense to use if you are in a Java SE environment. You might gain a small benefit from using HikariCP in an EE environment, but you will need to jump through additional hoops to get it working when you could just use the Liberty connection pool. In my opinion, your development time will be better spent elsewhere, because Liberty already has a well tested, well performing connection pool out of the box. Using an alternate connection pool on an app server that already provides a good one seems like an unnecessary micro-optimization.
Disclaimer: I am a Liberty developer who works on the connection pool among other things.
To answer your question:
Your configuration is for a DB2 database, not an Oracle database (i.e. properties.oracle
should be used instead of properties.db2.jcc
). Also, it has many additional properties specified that aren't necessary.
Your configuration can be simplified to this:
<library id="oracleJDBCJars" name="oracleJDBCJars">
<fileset dir="${shared.resource.dir}/oracle-jars" includes="*.jar"/>
</library>
<dataSource jndiName="jdbc/dev">
<jdbcDriver libraryRef="DB2JCC4Jars"/>
<properties.oracle URL="jdbc:oracle:thin:@//host.local.com:3714/DBU"
password="Admin12"
user="ADMIN"/>
</dataSource>
For more info on configuring a data source in Liberty, see this document:
Configuring relational database connectivity in Liberty
Validate your config:
If you have the April beta or newer, you can use the test connection service to check if your data source config works or not. See this article for a walkthrough on how to do that:
Testing database connections in Liberty apps with REST APIs
If you don't have the the April beta or newer, you can write a simple test servlet to attempt to get a connection.
Attempting to use HikariCP:
You will want to modify your jdbc driver <library>
to also include the HikariCP jars.
Next, modify your <dataSource>
to point to the HikariDataSource
implementation. You will need to set 2 attributes (noted below):
<!-- Tell the <dataSource> to use `javax.sql.DataSource` (as opposed to auto-detecting ConnectionPoolDataSource or XADataSource) -->
<dataSource jndiName="jdbc/dev" type="javax.sql.DataSource">
<!-- Tell the <jdbcDriver> what implementation class to use for `javax.sql.DataSource` -->
<jdbcDriver libraryRef="DB2JCC4Jars" javax.sql.DataSource="com.zaxxer.hikari.HikariDataSource"/>
<properties.oracle URL="jdbc:oracle:thin:@//host.local.com:3714/DBU"
password="Admin12"
user="ADMIN"/>
</dataSource>