Search in sources :

Example 71 with JdbcDataSource

use of org.h2.jdbcx.JdbcDataSource in project jdbi by jdbi.

the class TestOnDemandSqlObject method setUp.

@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()));
    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);
}
Also used : JdbcDataSource(org.h2.jdbcx.JdbcDataSource) Before(org.junit.Before)

Example 72 with JdbcDataSource

use of org.h2.jdbcx.JdbcDataSource in project jdbi by jdbi.

the class TestReentrancy method setUp.

@Before
public void setUp() throws Exception {
    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))");
}
Also used : SomethingMapper(org.jdbi.v3.core.mapper.SomethingMapper) JdbcDataSource(org.h2.jdbcx.JdbcDataSource) Before(org.junit.Before)

Example 73 with JdbcDataSource

use of org.h2.jdbcx.JdbcDataSource in project spring-boot by spring-projects.

the class DataSourceBuilderTests method buildWhenH2TypeSpecifiedWithDriverClassReturnsExpectedDataSource.

// gh-26631
@Test
void buildWhenH2TypeSpecifiedWithDriverClassReturnsExpectedDataSource() {
    this.dataSource = DataSourceBuilder.create().url("jdbc:h2:test").type(JdbcDataSource.class).driverClassName("org.h2.jdbcx.JdbcDataSource").username("test").password("secret").build();
    assertThat(this.dataSource).isInstanceOf(JdbcDataSource.class);
    JdbcDataSource h2DataSource = (JdbcDataSource) this.dataSource;
    assertThat(h2DataSource.getUser()).isEqualTo("test");
    assertThat(h2DataSource.getPassword()).isEqualTo("secret");
}
Also used : JdbcDataSource(org.h2.jdbcx.JdbcDataSource) Test(org.junit.jupiter.api.Test)

Example 74 with JdbcDataSource

use of org.h2.jdbcx.JdbcDataSource in project Activiti by Activiti.

the class MultiTenantProcessEngineTest method createDataSource.

// Helper //////////////////////////////////////////
private DataSource createDataSource(String jdbcUrl, String jdbcUsername, String jdbcPassword) {
    JdbcDataSource ds = new JdbcDataSource();
    ds.setURL(jdbcUrl);
    ds.setUser(jdbcUsername);
    ds.setPassword(jdbcPassword);
    return ds;
}
Also used : JdbcDataSource(org.h2.jdbcx.JdbcDataSource)

Example 75 with JdbcDataSource

use of org.h2.jdbcx.JdbcDataSource in project syndesis by syndesisio.

the class ActivityTrackingControllerTest method before.

@Before
public void before() {
    JdbcDataSource ds = new JdbcDataSource();
    ds.setURL("jdbc:h2:mem:t;DB_CLOSE_DELAY=-1;MODE=PostgreSQL");
    this.dbi = new DBI(ds);
    this.jsondb = new SqlJsonDB(dbi, null);
    this.jsondb.createTables();
}
Also used : SqlJsonDB(io.syndesis.server.jsondb.impl.SqlJsonDB) JdbcDataSource(org.h2.jdbcx.JdbcDataSource) DBI(org.skife.jdbi.v2.DBI) Before(org.junit.Before)

Aggregations

JdbcDataSource (org.h2.jdbcx.JdbcDataSource)81 Connection (java.sql.Connection)24 Test (org.junit.Test)24 Before (org.junit.Before)15 XAResource (javax.transaction.xa.XAResource)13 DataSource (javax.sql.DataSource)9 Xid (javax.transaction.xa.Xid)9 SQLException (java.sql.SQLException)8 InitialContext (javax.naming.InitialContext)8 XAConnection (javax.sql.XAConnection)8 RecoveryModule (com.arjuna.ats.arjuna.recovery.RecoveryModule)7 CommitMarkableResourceRecordRecoveryModule (com.arjuna.ats.internal.jta.recovery.arjunacore.CommitMarkableResourceRecordRecoveryModule)7 XARecoveryModule (com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule)7 XAResourceRecoveryHelper (com.arjuna.ats.jta.recovery.XAResourceRecoveryHelper)7 Statement (java.sql.Statement)7 BMScript (org.jboss.byteman.contrib.bmunit.BMScript)7 File (java.io.File)6 Enumeration (java.util.Enumeration)6 Properties (java.util.Properties)6 Vector (java.util.Vector)6