dataSource.setPassword((String) p .remove(DataSourceFactory.JDBC_PASSWORD));
dataSource.setURL((String) ref.get("url").getContent()); dataSource.setUser((String) ref.get("user").getContent()); dataSource.setPassword((String) ref.get("password").getContent()); dataSource.setDescription((String) ref.get("description").getContent()); String s = (String) ref.get("loginTimeout").getContent();
/** * Constructs a new connection pool for H2 databases. * * @param url the database URL of the H2 connection * @param user the user name * @param password the password * @return the connection pool */ public static JdbcConnectionPool create(String url, String user, String password) { JdbcDataSource ds = new JdbcDataSource(); ds.setURL(url); ds.setUser(user); ds.setPassword(password); return new JdbcConnectionPool(ds); }
private DataSource createDataSource(Config config) throws ClassNotFoundException { String url = config.getParameter(ExtConfig.JDBC_URL); String username = config.getParameter(ExtConfig.JDBC_USERNAME); String password = config.getParameter(ExtConfig.JDBC_PASSWORD); JdbcDataSource dataSource = new JdbcDataSource(); dataSource.setUrl(url); dataSource.setUser(username); dataSource.setPassword(password); return dataSource; }
private DataSource createDataSource(Config config) throws ClassNotFoundException { String url = config.getParameter(ExtConfig.JDBC_URL); String username = config.getParameter(ExtConfig.JDBC_USERNAME); String password = config.getParameter(ExtConfig.JDBC_PASSWORD); JdbcDataSource dataSource = new JdbcDataSource(); dataSource.setUrl(url); dataSource.setUser(username); dataSource.setPassword(password); return dataSource; }
@Override DataSource createDataSource() { JdbcDataSource dataSource = new JdbcDataSource(); dataSource.setUrl("jdbc:h2:~/testh2"); dataSource.setUser("sa"); dataSource.setPassword("sa"); return dataSource; } },
/** * Returns the JdbcDataSource created on the given file. * @param file The name of the file for the JdbcDataSource * @return The JdbcDataSource created */ private static DataSource source(final String file) { final JdbcDataSource src = new JdbcDataSource(); src.setURL(String.format("jdbc:h2:%s", file)); src.setUser(""); src.setPassword(""); return src; } }
JdbcDataSource ds = new JdbcDataSource(); ds.setURL("jdbc:h2:mem:test;MODE=Oracle"); ds.setUser("sa"); ds.setPassword("sa"); RunScript.execute(ds.getConnection(), new FileReader("schema.sql")); Server server = Server.createWebServer("-webAllowOthers"); server.start();
public static DataSource createDefaultDatabase(String name) { JdbcDataSource ds = new JdbcDataSource(); //ds.setURL("jdbc:h2:mem:" + name + ";mode=postgres"); ds.setURL("jdbc:h2:mem:" + name + ";MODE=PostgreSQL;DB_CLOSE_DELAY=-1"); ds.setUser("sa"); ds.setPassword("sa"); return ds; }
@Override public XADataSource getDataSource(String url) { JdbcDataSource dataSource = new JdbcDataSource(); dataSource.setURL(String.format("jdbc:%s;DB_CLOSE_DELAY=-1", url)); dataSource.setUser("sa"); dataSource.setPassword(""); return dataSource; } }
@Override public XADataSource getDataSource(String url) { JdbcDataSource dataSource = new JdbcDataSource(); dataSource.setURL(String.format("jdbc:%s;DB_CLOSE_DELAY=-1", url)); dataSource.setUser("sa"); dataSource.setPassword(""); return dataSource; } }
@Override public XADataSource getDataSource(String url) { JdbcDataSource dataSource = new JdbcDataSource(); dataSource.setURL(String.format("jdbc:%s;DB_CLOSE_DELAY=-1", url)); dataSource.setUser("sa"); dataSource.setPassword(""); return dataSource; } }
@Override public XADataSource getDataSource(String url) { JdbcDataSource dataSource = new JdbcDataSource(); dataSource.setURL(String.format("jdbc:%s;DB_CLOSE_DELAY=-1", url)); dataSource.setUser("sa"); dataSource.setPassword(""); return dataSource; } }
private DataSource createDataSource(Config config) throws ClassNotFoundException { String url = config.getParameter(ExtConfig.JDBC_URL); String username = config.getParameter(ExtConfig.JDBC_USERNAME); String password = config.getParameter(ExtConfig.JDBC_PASSWORD); JdbcDataSource dataSource = new JdbcDataSource(); dataSource.setUrl(url); dataSource.setUser(username); dataSource.setPassword(password); return dataSource; }
@Override protected synchronized void before() throws Throwable { final UUID uuid = UUID.randomUUID(); this.pool = new JdbcDataSource(); this.pool.setUrl("jdbc:h2:mem:" + uuid.toString() + ";MODE=PostgreSQL"); this.pool.setUser("h2"); this.pool.setPassword("h2"); this.conn = this.pool.getConnection(); }
private Connection getConnectionFor(String dbFilePath) throws SQLException { String username = config.get(DatabaseSettings.MYSQL_USER); String password = config.get(DatabaseSettings.MYSQL_PASS); JdbcDataSource jdbcDataSource = new JdbcDataSource(); jdbcDataSource.setURL("jdbc:h2:file:" + dbFilePath + ";mode=MySQL"); jdbcDataSource.setUser(username); jdbcDataSource.setPassword(password); return jdbcDataSource.getConnection(); }
@Override default DataSource createDataSource(SourceContext context) throws Exception { // Create the data source JdbcDataSource dataSource = new JdbcDataSource(); // Load optional properties DefaultDataSourceFactory.loadProperties(dataSource, context); // Load specification properties dataSource.setURL(context.getProperty(PROPERTY_URL)); dataSource.setUser(context.getProperty(PROPERTY_USER)); dataSource.setPassword(context.getProperty(PROPERTY_PASSWORD, "")); // Return the data source return dataSource; }
@Produces @LiquibaseType public DataSource createDataSource() throws SQLException { JdbcDataSource ds = new JdbcDataSource(); ds.setURL("jdbc:h2:mem:testliquibase_auto"); ds.setUser("sa"); ds.setPassword("sa"); return ds; } @Produces @LiquibaseType
private JdbcConnectionPool createDataSource() { ResourceHelper.forName(config.getJdbcDriver(), getClass()); JdbcDataSource datasource = new JdbcDataSource(); datasource.setURL(config.getJdbcUrl()); datasource.setUser(config.getJdbcUser()); datasource.setPassword(config.getJdbcPassword()); JdbcConnectionPool pooledDatasource = JdbcConnectionPool.create(datasource); pooledDatasource.setMaxConnections(config.getPoolMaxConnections()); return pooledDatasource; } }
public static void main(final String[] args) throws InterruptedException, TimeoutException, SQLException { String connectionString = args[0]; String semaphoreName = args[1]; JdbcDataSource ds = new JdbcDataSource(); ds.setURL(connectionString); ds.setUser("sa"); ds.setPassword("sa"); JdbcSemaphore semaphore = new JdbcSemaphore(ds, semaphoreName, 3); semaphore.acquire(1, 1L, TimeUnit.SECONDS); System.exit(0); }