Refine search
/** * 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); }
Reference ref = (Reference) obj; if (ref.getClassName().equals(JdbcDataSource.class.getName())) { 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());
logger.info("Starting H2 database in " + jdbcPath); JdbcDataSource jdbcds = new JdbcDataSource(); jdbcds.setURL("jdbc:h2:" + jdbcPath + "/kairosdb"); jdbcds.setUser("sa");
@Inject public H2DaoProvider(DbResourceGroupConfig config) { JdbcDataSource ds = new JdbcDataSource(); ds.setURL(requireNonNull(config.getConfigDbUrl(), "resource-groups.config-db-url is null")); // TODO: this should use onDemand() this.dao = Jdbi.create(ds) .installPlugin(new SqlObjectPlugin()) .open() .attach(H2ResourceGroupsDao.class); }
@Before public void setUp() { JdbcDataSource ds = new JdbcDataSource(); ds.setURL(String.format("jdbc:h2:mem:%s;MVCC=TRUE", UUID.randomUUID())); db = Jdbi.create(ds); db.installPlugin(new SqlObjectPlugin()); handle = db.open(); handle.execute("create table something (id int primary key, name varchar(100))"); }
@Before public void setUp() { ds = new JdbcDataSource(); // in MVCC mode h2 doesn't shut down immediately on all connections closed, so need random db name ds.setURL(String.format("jdbc:h2:mem:%s;MVCC=TRUE", UUID.randomUUID())); db = Jdbi.create(ds); db.installPlugin(new SqlObjectPlugin()); handle = db.open(); handle.execute("create table something (id int primary key, name varchar(100))"); db.installPlugin(tracker); }
@Before public void setUp() { JdbcDataSource ds = new JdbcDataSource(); // in MVCC mode h2 doesn't shut down immediately on all connections closed, so need random db name ds.setURL(String.format("jdbc:h2:mem:%s;MVCC=TRUE", UUID.randomUUID())); db = Jdbi.create(ds); db.installPlugin(new SqlObjectPlugin()); db.registerRowMapper(new SomethingMapper()); handle = db.open(); handle.execute("create table something (id int primary key, name varchar(100))"); }
@Before public void setUp() { JdbcDataSource ds = new JdbcDataSource(); ds.setURL("jdbc:h2:mem:" + UUID.randomUUID()); db = Jdbi.create(ds); db.installPlugin(new SqlObjectPlugin()); db.registerRowMapper(new SomethingMapper()); handle = db.open(); handle.execute("create table something (id int primary key, name varchar(100))"); }
private static DataSource createDataSource() { JdbcDataSource dataSource = new JdbcDataSource(); dataSource.setURL(DB_URL); 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; }
@Before public void setUp() throws Exception { JdbcDataSource ds = new JdbcDataSource(); ds.setURL(String.format("jdbc:h2:mem:%s;MVCC=TRUE", UUID.randomUUID())); dbi = new DBI(ds); handle = dbi.open(); handle.execute("create table something (id int primary key, name varchar(100))"); }
@Before public void setUp() throws Exception { ds = new JdbcDataSource(); // in MVCC mode h2 doesn't shut down immediately on all connections closed, so need random db name ds.setURL(String.format("jdbc:h2:mem:%s;MVCC=TRUE", UUID.randomUUID())); dbi = new DBI(ds); handle = dbi.open(); handle.execute("create table something (id int primary key, name varchar(100))"); }
@Before public void setUp() throws Exception { ds = new JdbcDataSource(); // in MVCC mode h2 doesn't shut down immediately on all connections closed, so need random db name ds.setURL(String.format("jdbc:h2:mem:%s;MVCC=TRUE", UUID.randomUUID())); dbi = new DBI(ds); handle = dbi.open(); handle.execute("create table something (id int primary key, name varchar(100))"); }
@Before public void setUp() throws Exception { JdbcDataSource ds = new JdbcDataSource(); ds.setURL(String.format("jdbc:h2:mem:%s;MVCC=TRUE", UUID.randomUUID())); dbi = new DBI(ds); handle = dbi.open(); handle.execute("create table something (id int primary key, name varchar(100))"); }
@Before public void setupJdbcTemplate() { JdbcDataSource h2DataSource = new JdbcDataSource(); h2DataSource.setURL("jdbc:h2:mem:"); DataSource wrap = SniffyDataSource.wrap(h2DataSource); jdbcTemplate = new NamedParameterJdbcTemplate(wrap); }
@Override public void setUp() throws Exception { JdbcDataSource ds = new JdbcDataSource(); ds.setURL("jdbc:h2:mem:test"); dbi = new DBI(ds); handle = dbi.open(); handle.execute("create table something (id int primary key, name varchar(100), a varchar(100), b int, c varchar(100))"); }
@Before public void setUp() throws Exception { JdbcDataSource ds = new JdbcDataSource(); ds.setURL("jdbc:h2:mem:" + UUID.randomUUID()); dbi = new DBI(ds); handle = dbi.open(); handle.execute("create table something (id int primary key, name varchar(100))"); }
@Override public void setUp() throws Exception { JdbcDataSource ds = new JdbcDataSource(); ds.setURL("jdbc:h2:mem:test"); dbi = new DBI(ds); handle = dbi.open(); handle.execute("create table something (id int primary key, name varchar(100), a varchar(100), b int, c varchar(100))"); }
@Before public void setUp() throws Exception { JdbcDataSource ds = new JdbcDataSource(); ds.setURL("jdbc:h2:mem:" + UUID.randomUUID()); dbi = new DBI(ds); h = dbi.open(); h.execute("create table something (id int primary key, name varchar(100))"); }