com.sap.cloud.mt.runtime.DataSourceCreatorHikari Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of multi-tenant-runtime Show documentation
Show all versions of multi-tenant-runtime Show documentation
Spring Boot Enablement Parent
The newest version!
/*******************************************************************************
* © 2019-2024 SAP SE or an SAP affiliate company. All rights reserved.
******************************************************************************/
package com.sap.cloud.mt.runtime;
import com.sap.cloud.mt.runtime.DataPoolSettings.Parameter;
import com.sap.cloud.mt.subscription.DataSourceInfo;
import com.sap.cloud.mt.subscription.exceptions.InternalError;
import com.zaxxer.hikari.HikariDataSource;
import javax.sql.DataSource;
import java.util.stream.Stream;
public class DataSourceCreatorHikari extends DataSourceCreator {
private final DataPoolSettings poolSettings;
public DataSourceCreatorHikari(DataPoolSettings poolSettings) {
this.poolSettings = poolSettings;
}
@Override
protected DataSource build(DataSourceInfo info) throws InternalError {
HikariDataSource hikariDataSource = new HikariDataSource();
hikariDataSource.setPoolName("HikariPool-" + info.getDatabaseId() + "#" + info.getTenantId());
hikariDataSource.setDriverClassName(info.getDriver());
hikariDataSource.setJdbcUrl(info.getUrl());
hikariDataSource.setUsername(info.getUser());
hikariDataSource.setPassword(info.getPassword());
return hikariDataSource;
}
@Override
protected Stream getPoolParameters() {
return poolSettings.getHikariParameters();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy