How to set up a profiler trace to find that my CallableStatement uses connection pool?
I set a trace to capture Audit:Login , Audit:Logout, RPC:Completed. But all I see is 1-Non-Pooled (image below). Is there any configuration in Hikari/JDBC driver to get the pool to work? I would expect my second call to the service be 2-Pooled in profiler.
Hikari configuration (I used both SQLServerDataSource and SQLServerConnectionPoolDataSource for datasourceclassname, both same result):
public HikariDataSource createHikariDataSource() {
HikariDataSource dbDatasource = new HikariDataSource();
dbDatasource.setDataSourceClassName("com.microsoft.sqlserver.jdbc.SQLServerConnectionPoolDataSource");
dbDatasource.addDataSourceProperty("databaseName", "tempdb");
dbDatasource.setPoolName("myJDBCTestConnectionPool");
dbDatasource.setUsername("someuser");
dbDatasource.setPassword("totallysafepassword");
dbDatasource.setMinimumIdle(5);
dbDatasource.setMaximumPoolSize(10);
dbDatasource.setConnectionTimeout(300);
dbDatasource.setIdleTimeout(1000);
dbDatasource.setMaxLifetime(1000);
return dbDatasource;
}
Proc execution code (redacted)
public void execMyProc() {
HikariDataSource hkds = createHikariDataSource();
Connection conn = hkds.getConnection();
CallableStatement stmt3 = conn.prepareCall({? = CALL dbo.connectionpooltest @InputParam1=?});
stmt3.registerOutParameter(1,Types.INTEGER);
stmt3.setInt(2,1);
ResultSet rs1 = stmt3.executeQuery();
rs1.close();
conn.close();
}
HikariCP and mssql-jdbc maven pom.xml entries
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>3.4.5</version>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>8.4.0.jre8</version>
</dependency>
SQL Code
use tempdb;
go
create or alter proc connectionpooltest (@InputParam1 int)
as
begin
return @InputParam1;
end;
go
Profiler screenshot:
Java Version : 1.8.281 (Language level 11 or 8)
SQL Server 2017 Developer Edition (same behavior on 2014 and 2019)
Is there anyway to reliably say that my HikariCP configuration is using a pool? How do I find it using profiler/prefmon/other tools?