dataSource.setUser((String) p.remove(DataSourceFactory.JDBC_USER));
JdbcDataSource dataSource = new JdbcDataSource(); 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());
jdbcds.setUser("sa");
/** * 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; } },
@Before public void setUp() throws Exception { // make sure to reinit properly new P6TestFramework("ds") { }; jndiResources = new ArrayList<Resource>(); // create the real data sources and bind to jndi JdbcDataSource realDs1 = new JdbcDataSource(); realDs1.setUser("sa"); realDs1.setURL("jdbc:h2:mem:multids1"); jndiResources.add(new Resource("jdbc/realDs1", realDs1)); JdbcDataSource realDs2 = new JdbcDataSource(); realDs2.setUser("sa"); realDs2.setURL("jdbc:h2:mem:multids2"); jndiResources.add(new Resource("jdbc/realDs2", realDs2)); JDBCDataSource realDs3 = new JDBCDataSource(); realDs3.setUser("sa"); realDs3.setPassword(""); realDs3.setUrl("jdbc:hsqldb:mem:multids3"); jndiResources.add(new Resource("jdbc/realDs3", realDs3)); // create the spy wrapper data sources and bind to jndi P6DataSource spyDs1 = new P6DataSource(); spyDs1.setRealDataSource("jdbc/realDs1"); jndiResources.add(new Resource("jdbc/spyDs1", spyDs1)); P6DataSource spyDs3 = new P6DataSource(); spyDs3.setRealDataSource("jdbc/realDs3"); jndiResources.add(new Resource("jdbc/spyDs3", spyDs3)); // reset captured log messages ((P6TestLogger) P6LogQuery.getLogger()).clearLogs(); }
@Override protected Connection createConnection() throws SQLException { final JdbcDataSource ds = new org.h2.jdbcx.JdbcDataSource(); ds.setURL("jdbc:h2:" + dbFileName.getAbsolutePath() + ";DB_CLOSE_ON_EXIT=FALSE"); ds.setUser("sa"); Connection results = ds.getConnection(); results.setAutoCommit(false); return results; }
@Override protected Connection createConnection() throws SQLException { final JdbcDataSource ds = new org.h2.jdbcx.JdbcDataSource(); ds.setURL("jdbc:h2:" + dbFileName.getAbsolutePath() + ";DB_CLOSE_ON_EXIT=FALSE"); ds.setUser("sa"); Connection results = ds.getConnection(); results.setAutoCommit(false); return results; }
@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; }
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); }