B4J Library HikariCP - High Performance Connection Pool

mindful

Active Member
Licensed User
Would it be possible to add an additional Initialize method? For Microsoft SQL, one has to set a connectionTestString (to avoid the isValid error). But it can't be set after initialize.
Done - First post is updated with v.1.10

But I think that it could have been set with JavaObject:
B4X:
Dim jocp As JavaObject = cp
jocp.RunMethod("setConnectionTestQuery", Array("SELECT 1"))
 

alwaysbusy

Expert
Licensed User
Longtime User
Looks like there is a problem with the lib when using JDK 9 (+ HTTP2?):

My log:
B4X:
Waiting for debugger to connect...
Program started.
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Error occurred on line: 68 (DBM)
java.sql.SQLException: I/O Error: SSO Failed: Native SSPI library not loaded. Check the java.library.path system property.
   at net.sourceforge.jtds.jdbc.TdsCore.login(TdsCore.java:654)
   at net.sourceforge.jtds.jdbc.JtdsConnection.<init>(JtdsConnection.java:371)
   at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:184)
   at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:117)
   at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:375)
   at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:204)
   at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:459)
   at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:533)
   at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:114)
   at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:97)
   at ro.mindful.wrapper.HikariCP.HikariDataSourceWrapper.GetConnection(HikariDataSourceWrapper.java:60)
   at com.onetwo.dbm._getsql(dbm.java:114)
   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.base/java.lang.reflect.Method.invoke(Method.java:564)
   at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:625)
   at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:234)
   at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:168)
   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.base/java.lang.reflect.Method.invoke(Method.java:564)
   at anywheresoftware.b4a.BA.raiseEvent2(BA.java:90)
   at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:94)
   at anywheresoftware.b4a.BA.raiseEvent(BA.java:77)
   at com.onetwo.main.main(main.java:29)
Caused by: java.io.IOException: SSO Failed: Native SSPI library not loaded. Check the java.library.path system property.
   at net.sourceforge.jtds.jdbc.TdsCore.sendMSLoginPkt(TdsCore.java:1963)
   at net.sourceforge.jtds.jdbc.TdsCore.login(TdsCore.java:617)
   ... 26 more

As in JDK 9, one cannot use the '#VirtualMachineArgs: -Xbootclasspath/p:alpn-boot-8.1.7.v20160121.jar param anymore, it looks like HikariCP still uses it.

Maybe recompiling it with JDK 9 would solve this?
 

mindful

Active Member
Licensed User
@alwaysbusy I will have a look to see if there is something special that needs to be done for java 9.

But while reading the error it looks like it raises from the jdbc driver you are using ( net.sourceforge.jtds ) which I think doesn't support java 9 - I only tested this with mysql driver and mariadb. Anyway I will have a look
B4X:
   at net.sourceforge.jtds.jdbc.TdsCore.login(TdsCore.java:654)
   at net.sourceforge.jtds.jdbc.JtdsConnection.<init>(JtdsConnection.java:371)
   at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:184)
 

alwaysbusy

Expert
Licensed User
Longtime User
Turns out I forgot to put the ntlmauth.dll in the new jdk 9 bin folder. This dll is needed for secure MSSQL connections. As I don't upgrade my java with 'every' new release, I completely forgot about that one. So works fine now with your lib, JDK 9 and HTTP2
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…