How to use HikariCP with WebSphere Liberty


we are using oracle database, this is how we configured JNDI against oracle on liberty profile, I want to use hikarui-cp instead if javax.sql.ConnectionPoolDataSource.

<library id="oracleJDBCJars" name="oracleJDBCJars"> <fileset dir="${shared.resource.dir}/oracle-jars" includes="*.jar"/> </library> <dataSource beginTranForResultSetScrollingAPIs="true" beginTranForVendorAPIs="false" commitOrRollbackOnCleanup="rollback" connectionManagerRef="default-conn-mgr" isolationLevel="TRANSACTION_READ_COMMITTED" jndiName="jdbc/dev" transactional="true" type="javax.sql.ConnectionPoolDataSource"> <jdbcDriver libraryRef="oracleJDBCJars"/> <properties.oracle currentSchema="DEV" databaseName="DBU" password="Admin12" portNumber="3714" serverName="host.local.com" user="ADMIN"/> </dataSource>


<strong>Opinion part:</strong><br /> 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 <em>if you are in a Java SE environment</em>. 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. <br /><em>Disclaimer: I am a Liberty developer who works on the connection pool among other things.</em>

<hr />

<strong>To answer your question:</strong><br /> 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:<br /><a href="https://www.ibm.com/support/knowledgecenter/SS7K4U_8.5.5/com.ibm.websphere.wlp.zseries.doc/ae/twlp_dep_configuring_ds.html" rel="nofollow">Configuring relational database connectivity in Liberty</a>

<strong>Validate your config:</strong><br /> 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:<br /><a href="https://developer.ibm.com/wasdev/blog/2017/04/19/testing-database-connections/" rel="nofollow">Testing database connections in Liberty apps with REST APIs</a> <br /> If you don't have the the April beta or newer, you can write a simple test servlet to attempt to get a connection.

<strong>Attempting to use HikariCP:</strong><br /> 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>


  • Get age from the birthday field with type date using SQL
  • Setting up a jdbc connection pool for sybase
  • Try Catch Can't handle alter table
  • Transferring variable from batch to VBScript file returns empty
  • Sharing file descriptor using Android binder
  • java.lang.IllegalStateException: Not on the main thread Google Maps
  • How to select column names from multiple tables in SQL Server 2000-2008 that are in a set of names
  • UDP with multiple sender and one single receiver
  • Getting Intermittent Connection Errors After Attaching a SQL Server Database
  • SQLException: the result set is closed
  • Why Apache POI XWPFRun.setFontFamily() for cyrillic works wrong?
  • Unable to set item datetime (as PT_SYSTIME) using PropertyAccessor in Outlook VSTO
  • Edit sqlite file from terminal Mac
  • How to get executing server name or address with Selenium Server 2.20
  • Sqlite: Execute Spatialite Functions in Intellij
  • Xampp PHP server GET works Fine POST isn't working
  • Ansible Expect module can't match string/regex script questions
  • Angular ng-style background image when url contain spaces
  • can't serialize class in MongoDB Java and String are encoded
  • Any command to show how many applications are currently running under Tomcat?
  • use variable in FROM statement
  • COM+ invoking method in remote instance Unknown name error
  • Apache redirect from root
  • IllegalArgumentException: The servlets named [HelloWorlds] and [Hello] are both mapped to the url-pa
  • Android NFC read Tags issue. Activity starts each time on data received
  • openssl handshake failed
  • How to resolve docker host names (/etc/hosts) in containers
  • ADO and msqli connections very slow
  • PHP buffered output depending on server setting?
  • MongoError: Incorrect arguments
  • Django rest serializer Breaks when data exists
  • need help with bizarre java.net.HttpURLConnection behavior
  • Turn off referential integrity in Derby? is it possible?
  • Authorize attributes not working in MVC 4
  • Are Kotlin's Float, Int etc optimised to built-in types in the JVM? [duplicate]
  • Busy indicator not showing up in wpf window [duplicate]
  • costura.fody for a dll that references another dll
  • UserPrincipal.Current returns apppool on IIS
  • Python/Django TangoWithDjango Models and Databases
  • Net Present Value in Excel for Grouped Recurring CF