I'm trying to use HikariCP together with DB2 but get the following error:
Failure in loading native library db2jcct2, java.lang.UnsatisfiedLinkError: db2jcct2
I have db2jcc4.jar file at my class path and only it. And the following hikari properties file:
dataSourceClassName=com.ibm.db2.jcc.DB2SimpleDataSource
dataSource.user=username
dataSource.password=password
dataSource.databaseName=database
dataSource.serverName=server:50000
From what I understand Hikari tries to use type 2 driver and therefor it requires native library db2jcct2 is it right? And if yes, how can I say it implicitly to look for type 4 driver?
Update: Proposed answer doesn't solve my issue. It can give direction but I could't get the correct answer only by reading that answer. At the same time you can find the answer in the comments to this question.
This question is equivalent to Why is DB2 Type 4 JDBC Driver looking for native library db2jcct2?
If you were configuring the
DataSource
in code you would need to do this:DataSources are javabeans. The convention of javabeans is that a pair of
setXxxx
/getXxx
represents the propertyxxxx
. So a settersetDriverType
is equivalent to the propertydriverType
.The hikari properties configure a datasource by defining the properties (which are then set through reflection). To do the equivalent of
setDriverType(4)
, you need to use propertydriverType=4
. Given the convention used in that properties file that leads to: