use of com.mchange.v2.c3p0.jacksonTest.ComboPooledDataSource in project RecordManager2 by moravianlibrary.
the class WebAppConfig method dataSource.
@Bean
public DataSource dataSource(@Value("${jdbc.driverClassName}") String driverClassName, @Value("${jdbc.url}") String url, @Value("${jdbc.username}") String username, @Value("${jdbc.password}") String password) throws PropertyVetoException {
ComboPooledDataSource dataSource = new ComboPooledDataSource();
dataSource.setDriverClass(driverClassName);
dataSource.setJdbcUrl(url);
dataSource.setUser(username);
dataSource.setPassword(password);
return dataSource;
}
use of com.mchange.v2.c3p0.jacksonTest.ComboPooledDataSource in project netxms by netxms.
the class DaoContextConfig method dataSource.
@Bean
@Qualifier("systemDataSource")
public DataSource dataSource() throws PropertyVetoException {
ComboPooledDataSource dataSource = new ComboPooledDataSource();
ServerSettings.DataSourceConfig dataSourceConfig = settings.getDataSourceConfig(ServerSettings.DC_ID_SYSTEM);
dataSource.setDriverClass(dataSourceConfig.getDriver());
dataSource.setJdbcUrl(dataSourceConfig.getUrl());
dataSource.setUser(dataSourceConfig.getUsername());
dataSource.setPassword(dataSourceConfig.getPassword());
dataSource.setTestConnectionOnCheckout(true);
dataSource.setCheckoutTimeout(3000);
dataSource.setIdleConnectionTestPeriod(300);
return dataSource;
}
use of com.mchange.v2.c3p0.jacksonTest.ComboPooledDataSource in project opencast by opencast.
the class PersistenceUtil method newEntityManagerFactory.
public static EntityManagerFactory newEntityManagerFactory(String emName, String vendor, String driver, String url, String user, String pwd, Map<String, ?> persistenceProps, PersistenceProvider pp) {
// Set up the database
final ComboPooledDataSource pooledDataSource = new ComboPooledDataSource();
try {
pooledDataSource.setDriverClass(driver);
} catch (PropertyVetoException e) {
throw new RuntimeException(e);
}
pooledDataSource.setJdbcUrl(url);
pooledDataSource.setUser(user);
pooledDataSource.setPassword(pwd);
// Set up the persistence properties
final Map<String, Object> props = Immutables.<String, Object>map(persistenceProps, tuple("javax.persistence.nonJtaDataSource", pooledDataSource), tuple("eclipselink.target-database", vendor));
final EntityManagerFactory emf = pp.createEntityManagerFactory(emName, props);
if (emf == null) {
throw new Error("Cannot create entity manager factory for persistence unit " + emName + ". Maybe you misspelled the name of the persistence unit?");
}
return emf;
}
use of com.mchange.v2.c3p0.jacksonTest.ComboPooledDataSource in project opencast by opencast.
the class PersistenceUtil method mkEntityManagerFactory.
public static EntityManagerFactory mkEntityManagerFactory(String emName, String vendor, String driver, String url, String user, String pwd, Map<String, ?> persistenceProps, PersistenceProvider pp) {
// Set up the database
final ComboPooledDataSource pooledDataSource = new ComboPooledDataSource();
try {
pooledDataSource.setDriverClass(driver);
} catch (PropertyVetoException e) {
throw new RuntimeException(e);
}
pooledDataSource.setJdbcUrl(url);
pooledDataSource.setUser(user);
pooledDataSource.setPassword(pwd);
// Set up the persistence properties
final Map<String, Object> props = Immutables.<String, Object>map(persistenceProps, tuple("javax.persistence.nonJtaDataSource", pooledDataSource), tuple("eclipselink.target-database", vendor));
final EntityManagerFactory emf = pp.createEntityManagerFactory(emName, props);
if (emf == null) {
throw new Error("Cannot create entity manager factory for persistence unit " + emName + ". Maybe you misspelled the name of the persistence unit?");
}
return emf;
}
use of com.mchange.v2.c3p0.jacksonTest.ComboPooledDataSource in project opencast by opencast.
the class SchedulerMigrationServiceTest method createDataSource.
private DataSource createDataSource(String databaseUrl, String databaseUser, String databasePassword) {
final Map<String, String> testEntityManagerProps = new HashMap<>();
testEntityManagerProps.put("eclipselink.ddl-generation", "none");
testEntityManagerProps.put("eclipselink.ddl-generation.output-mode", "database");
final ComboPooledDataSource pooledDataSource = new ComboPooledDataSource();
try {
pooledDataSource.setDriverClass("com.mysql.jdbc.Driver");
} catch (PropertyVetoException e) {
throw new RuntimeException(e);
}
pooledDataSource.setJdbcUrl(databaseUrl);
pooledDataSource.setUser(databaseUser);
pooledDataSource.setPassword(databasePassword);
return pooledDataSource;
}
Aggregations