I have a procedure that required config param from session using current_settings("domainid", "123"). that I need to set into session of HikariDataSource but through yml.
I have tried below ways to set into yml but its not working
Set into datasource: datasource.connectionProperties: domainid=123
Set into hikari
datasource.hikari data-source-properties: domainid:123Set into datasource tomcat
datasource.tomcat.connection-properties:domainid=123
I am using spring boot 2.3.5 release versiin. let me know if anyone has idea. thanks in advance
I can't set below set connection property to yml public class TenantAwareHikariDataSource extends HikariDataSource {
@Override
public Connection getConnection() throws SQLException {
Connection connection = super.getConnection();
try (Statement sql = connection.createStatement()) {
sql.execute("SET app.current_tenant = '" + ThreadLocalStorage.getTenantName() + "'");
}
return connection;
}
@Override
public Connection getConnection(String username, String password) throws SQLException {
Connection connection = super.getConnection(username, password);
try (Statement sql = connection.createStatement()) {
sql.execute("SET app.current_tenant = '" + ThreadLocalStorage.getTenantName() + "'");
}
return connection;
}
}