use of org.h2.jdbcx.JdbcDataSource in project ma-core-public by infiniteautomation.
the class H2Proxy method initializeImpl.
@Override
protected void initializeImpl(String propertyPrefix) {
LOG.info("Initializing H2 connection manager");
JdbcDataSource jds = new JdbcDataSource();
jds.setURL(getUrl(propertyPrefix));
jds.setDescription("maDataSource");
String user = Common.envProps.getString(propertyPrefix + "db.username", null);
if (user != null) {
jds.setUser(user);
String password = Common.envProps.getString(propertyPrefix + "db.password", null);
if (password != null)
jds.setPassword(password);
}
dataSource = JdbcConnectionPool.create(jds);
dataSource.setMaxConnections(Common.envProps.getInt(propertyPrefix + "db.pool.maxActive", 100));
if (Common.envProps.getBoolean(propertyPrefix + "db.web.start", false)) {
LOG.info("Initializing H2 web server");
String[] webArgs = new String[4];
webArgs[0] = "-webPort";
webArgs[1] = Common.envProps.getString(propertyPrefix + "db.web.port");
webArgs[2] = "-ifExists";
webArgs[3] = "-webAllowOthers";
try {
this.web = Server.createWebServer(webArgs);
this.web.start();
} catch (SQLException e) {
LOG.error(e);
}
}
}
use of org.h2.jdbcx.JdbcDataSource in project syndesis by syndesisio.
the class JsonDBTest method before.
@Before
public void before() {
JdbcDataSource ds = new JdbcDataSource();
ds.setURL("jdbc:h2:mem:test1;DB_CLOSE_DELAY=-1;MODE=PostgreSQL");
DBI dbi = new DBI(ds);
this.jsondb = new SqlJsonDB(dbi, null, Arrays.asList(new Index("/pair", "key"), new Index("/users", "name"), new Index("/users", "age")));
try {
this.jsondb.dropTables();
} catch (Exception e) {
}
this.jsondb.createTables();
}
use of org.h2.jdbcx.JdbcDataSource in project sandbox by irof.
the class FirstTest method setup.
@Before
public void setup() throws Exception {
// H2DatabaseのDataSourceを用意
dataSource = new JdbcDataSource();
dataSource.setURL("jdbc:h2:mem:temp;DB_CLOSE_DELAY=-1");
dataSource.setUser("sa");
// Flywayでテーブル作成
Flyway flyway = new Flyway();
flyway.setDataSource(dataSource);
flyway.migrate();
}
use of org.h2.jdbcx.JdbcDataSource in project quickstarts by jboss-switchyard.
the class CamelJpaBindingTest method beforeClass.
@BeforeClass
public static void beforeClass() throws Exception {
namingMixIn = new NamingMixIn();
namingMixIn.initialize();
connection = DriverManager.getConnection("jdbc:h2:mem:events-jpa-quickstart", "sa", "sa");
JdbcDataSource ds = new JdbcDataSource();
ds.setURL("jdbc:h2:mem:events-jpa-quickstart");
ds.setUser("sa");
ds.setPassword("sa");
InitialContext initialContext = new InitialContext();
bind(initialContext, System.getProperty("jpa.persistence.datasource.name"), ds);
}
use of org.h2.jdbcx.JdbcDataSource in project quickstarts by jboss-switchyard.
the class CamelSqlBindingTest method startUp.
@BeforeClass
public static void startUp() throws Exception {
dataSource = new JdbcDataSource();
dataSource.setURL("jdbc:h2:mem:test");
dataSource.setUser("sa");
dataSource.setPassword("sa");
connection = dataSource.getConnection();
String createStatement = "CREATE TABLE greetings (" + "id INT PRIMARY KEY AUTO_INCREMENT, " + "receiver VARCHAR(255), " + "sender VARCHAR(255) " + ");";
connection.createStatement().executeUpdate("DROP TABLE IF EXISTS greetings");
connection.createStatement().executeUpdate(createStatement);
namingMixIn = new NamingMixIn();
namingMixIn.initialize();
bindDataSource(namingMixIn.getInitialContext(), "java:jboss/myDS", dataSource);
}
Aggregations