use of org.springframework.jdbc.datasource.DriverManagerDataSource in project tutorials by eugenp.
the class AppConfig method dataSource.
@Bean
public DataSource dataSource() {
final DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName(env.getProperty("driverClassName"));
dataSource.setUrl(env.getProperty("url"));
dataSource.setUsername(env.getProperty("user"));
dataSource.setPassword(env.getProperty("password"));
return dataSource;
}
use of org.springframework.jdbc.datasource.DriverManagerDataSource in project tutorials by eugenp.
the class PersistenceConfig method dataSource.
//
@Bean
public DataSource dataSource() {
final DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName(Preconditions.checkNotNull(env.getProperty("jdbc.driverClassName")));
dataSource.setUrl(Preconditions.checkNotNull(env.getProperty("jdbc.url")));
dataSource.setUsername(Preconditions.checkNotNull(env.getProperty("jdbc.user")));
dataSource.setPassword(Preconditions.checkNotNull(env.getProperty("jdbc.pass")));
return dataSource;
}
use of org.springframework.jdbc.datasource.DriverManagerDataSource in project workbench by all-of-us.
the class TestJpaConfig method dataSource.
@Bean
public DataSource dataSource() {
final DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("org.h2.Driver");
dataSource.setUrl("jdbc:h2:mem:db;DB_CLOSE_DELAY=-1");
dataSource.setUsername("sa");
dataSource.setPassword("sa");
return dataSource;
}
use of org.springframework.jdbc.datasource.DriverManagerDataSource in project narayana by jbosstm.
the class StableConnections method getDataSource.
private static DataSource getDataSource(String user) throws NamingException, SQLException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException, ClassNotFoundException {
InitialContext initialContext = prepareInitialContext();
Class clazz = Class.forName("org.postgresql.xa.PGXADataSource");
XADataSource xaDataSource = (XADataSource) clazz.newInstance();
clazz.getMethod("setServerName", new Class[] { String.class }).invoke(xaDataSource, new Object[] { DB_HOST });
clazz.getMethod("setDatabaseName", new Class[] { String.class }).invoke(xaDataSource, new Object[] { DB_SID });
clazz.getMethod("setUser", new Class[] { String.class }).invoke(xaDataSource, new Object[] { user });
clazz.getMethod("setPassword", new Class[] { String.class }).invoke(xaDataSource, new Object[] { user });
clazz.getMethod("setPortNumber", new Class[] { int.class }).invoke(xaDataSource, new Object[] { 5432 });
final String name = "java:/comp/env/jdbc/" + user;
initialContext.bind(name, xaDataSource);
DriverManagerDataSource dataSource = new DriverManagerDataSource("jdbc:arjuna:" + name);
dataSource.setDriverClassName("com.arjuna.ats.jdbc.TransactionalDriver");
return dataSource;
}
use of org.springframework.jdbc.datasource.DriverManagerDataSource in project irida by phac-nml.
the class JobDetailsCommandLineTransfer method main.
public static void main(String[] args) {
checkNotNull(GALAXY_URL, "Galaxy URL is required. [galaxy.url]");
checkNotNull(GALAXY_API, "Galaxy API key is required. [galaxy.api.key]");
checkNotNull(JDBC_URL, "JDBC URL is required. [jdbc.url]");
checkNotNull(JDBC_USER, "JDBC user is required. [jdbc.user]");
checkNotNull(JDBC_PASS, "JDBC password is required. [jdbc.pass]");
final GalaxyInstance gi = GalaxyInstanceFactory.get(GALAXY_URL, GALAXY_API);
final JobsClient jobsClient = gi.getJobsClient();
final DriverManagerDataSource dataSource = new DriverManagerDataSource(JDBC_URL, JDBC_USER, JDBC_PASS);
dataSource.setDriverClassName("com.mysql.jdbc.Driver");
final JdbcTemplate template = new JdbcTemplate(dataSource);
template.query("select id, execution_manager_identifier from tool_execution", (rs, row) -> Pair.of(rs.getLong("id"), rs.getString("execution_manager_identifier"))).forEach(e -> {
final JobDetails jobDetails = jobsClient.showJob(e.v);
template.update("update tool_execution set command_line = ? where id = ?", jobDetails.getCommandLine(), e.k);
logger.debug(String.format("Updated tool execution [%s] with command line [%s]", e.k, jobDetails.getCommandLine()));
});
}
Aggregations