Search in sources :

Example 1 with ProxyDataSource

use of com.haulmont.cuba.core.sys.jdbc.ProxyDataSource in project cuba by cuba-platform.

the class DataSourceProvider method getApplicationDataSource.

protected DataSource getApplicationDataSource(String storeName) {
    String actualStoreName = storeName == null ? Stores.MAIN : storeName;
    Map<String, String> dsParameters = getDataSourceParameters(actualStoreName);
    HikariConfig config = getConnectionPoolConfig(actualStoreName, dsParameters);
    return new ProxyDataSource(new HikariDataSource(config));
}
Also used : HikariDataSource(com.zaxxer.hikari.HikariDataSource) HikariConfig(com.zaxxer.hikari.HikariConfig) ProxyDataSource(com.haulmont.cuba.core.sys.jdbc.ProxyDataSource)

Example 2 with ProxyDataSource

use of com.haulmont.cuba.core.sys.jdbc.ProxyDataSource in project cuba by cuba-platform.

the class DataSourceProvider method getJndiDataSource.

protected DataSource getJndiDataSource(String jndiName) {
    Preconditions.checkNotNull(jndiName, "Jndi name is null");
    DataSourceLookup lookup = new JndiDataSourceLookup();
    return new ProxyDataSource(lookup.getDataSource(jndiName));
}
Also used : JndiDataSourceLookup(org.springframework.jdbc.datasource.lookup.JndiDataSourceLookup) DataSourceLookup(org.springframework.jdbc.datasource.lookup.DataSourceLookup) JndiDataSourceLookup(org.springframework.jdbc.datasource.lookup.JndiDataSourceLookup) ProxyDataSource(com.haulmont.cuba.core.sys.jdbc.ProxyDataSource)

Aggregations

ProxyDataSource (com.haulmont.cuba.core.sys.jdbc.ProxyDataSource)2 HikariConfig (com.zaxxer.hikari.HikariConfig)1 HikariDataSource (com.zaxxer.hikari.HikariDataSource)1 DataSourceLookup (org.springframework.jdbc.datasource.lookup.DataSourceLookup)1 JndiDataSourceLookup (org.springframework.jdbc.datasource.lookup.JndiDataSourceLookup)1