I have a java app (jdk 11) that uses HikariCP (version 4.0.3) to execute queries and return results. I am using sqlServer java lib version 8.2.0.jre11 & the app runs on a Kubernetes cluster.
Lately I have been seeing two different errors:
Happens when calling createPool() below. "Error thrown while acquiring connection from data source ? Caused by: java.net.SocketTimeoutException: Read Time out"
Happens when calling getConnection() "Caused by: FAILED to get database connection driver."
Both these are happening sporadically. Any ideas/hints/tips as to what's going on would be appreciated. I turned on the debug level logging and it doesn't show any connection leaks when it does manage to make connections.
Thanks
public class DBTester{
private final HikariPool pool;
DBTester( ){
this.pool = createPool( createConfig() );
}
protected final HikariPool createPool( HikariConfig pool ){
return new HikariPool(config);
}
public final Connection getConnection(){
return pool.getConnection();
}
private static final HikariConfig createConfig( ){
HikariConfig config = new HikariConfig();
config.setPoolName("TestPool");
config.setDriverClassName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
config.setJdbcUrl("jdbc:sqlserver://DBNAME.company.com:4444;databaseName=testDB;integratedSecurity=true;authenticationSchema=JavaKerberos");
config.setMinimumIdle( 10 );
config.setMaximumPoolSize( 20 );
config.setAutoCommit( false );
config.setReadOnly( false );
config.setIdleTimeout( 60_0000 );
config.setConnectionTimeout(60_000);
config.setLeakDetectionThreshold( 60_000 );
config.setConnectionInitSql("SELECT 1");
config.setConnectionTestQuery("SELECT 1");
config.addDataSourceProperty("cachePrepStmts", "true");
config.addDataSourceProperty("useServerPrepStmts", "true");
config.addDataSourceProperty("cacheResultsSetMeta", "true");
config.addDataSourceProperty("prepStmtCacheSize", "250");
config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
}
}