HikariCP connection SoketTimeoutConnection

169 views
Skip to first unread message

TheWittyRascal

unread,
Jul 25, 2021, 8:35:22 PM7/25/21
to HikariCP
Hello,

I have a java app that uses a connection pool to execute queries and return results.
I am using jdk=11, HicariCp Version = 4.0.3,  sqlServer version= 8.2.0.jre11 and it runs on a Kubernetes cluster.

Lately I have been seeing two different errors:

1. Happens when calling createPool() below.
"Error thrown while acquiring connection from data source ? Caused by: java.net.SocketTimeoutException: Read Time out"

2. Happens when calling getConnection()
"Caused by: FAILED to get database connection driver."

Any ideas/hints/tips as to what's going on would be appreciated.

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");
}

}

Reply all
Reply to author
Forward
0 new messages