Java Code Examples for org.hsqldb.jdbc.pool.JDBCXADataSource

The following examples show how to use org.hsqldb.jdbc.pool.JDBCXADataSource. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: glowroot   Source File: Connections.java    License: Apache License 2.0 6 votes vote down vote up
static PoolingDataSource createBitronixWrappedDataSource() throws AssertionError {
    if (Connections.class.getClassLoader() instanceof IsolatedWeavingClassLoader) {
        throw new AssertionError("Bitronix loads JdbcProxyFactory implementation using a"
                + " parent-first class loader, which bypasses IsolatedWeavingClassLoader, must"
                + " use JavaagentContainer");
    }
    PoolingDataSource ds = new PoolingDataSource();
    ds.setClassName(JDBCXADataSource.class.getName());
    Properties props = new Properties();
    props.setProperty("url", "jdbc:hsqldb:mem:test");
    ds.setDriverProperties(props);
    ds.setMaxPoolSize(1);
    ds.setUniqueName("unique-name-" + nextUniqueNum++);
    ds.setAllowLocalTransactions(true);
    return ds;
}
 
Example 2
Source Project: tomee   Source File: XABoneCPTest.java    License: Apache License 2.0 6 votes vote down vote up
@Configuration
public Properties props() {
    return new PropertiesBuilder()
        .p("openejb.jdbc.datasource-creator", BoneCPDataSourceCreator.class.getName())

        .p("txMgr", "new://TransactionManager?type=TransactionManager")
        .p("txMgr.txRecovery", "true")
        .p("txMgr.logFileDir", "target/test/xa/howl")

            // real XA datasources
        .p("xa", "new://Resource?class-name=" + JDBCXADataSource.class.getName())
        .p("xa.url", "jdbc:hsqldb:mem:tomcat-xa")
        .p("xa.user", "sa")
        .p("xa.password", "")
        .p("xa.SkipImplicitAttributes", "true")

        .p("xadb", "new://Resource?type=DataSource")
        .p("xadb.xaDataSource", "xa")
        .p("xadb.JtaManaged", "true")

        .build();
}
 
Example 3
Source Project: tomee   Source File: XAPoolTest.java    License: Apache License 2.0 6 votes vote down vote up
@Configuration
public Properties props() {
    return new PropertiesBuilder()
        .p("openejb.jdbc.datasource-creator", DefaultDataSourceCreator.class.getName())

        .p("txMgr", "new://TransactionManager?type=TransactionManager")
        .p("txMgr.txRecovery", "true")
        .p("txMgr.logFileDir", "target/test/xa/howl_XAPoolTest")

            // real XA datasources
        .p("xa", "new://Resource?class-name=" + JDBCXADataSource.class.getName())
        .p("xa.url", "jdbc:hsqldb:mem:dbcpxa")
        .p("xa.user", "sa")
        .p("xa.password", "")
        .p("xa.SkipImplicitAttributes", "true")
        .p("xa.SkipPropertiesFallback", "true") // otherwise goes to connection properties

        .p("xadb", "new://Resource?type=DataSource")
        .p("xadb.xaDataSource", "xa")
        .p("xadb.JtaManaged", "true")
        .p("xadb.MaxIdle", "25")
        .p("xadb.MaxTotal", "25")
        .p("xadb.InitialSize", "3")

        .build();
}
 
Example 4
Source Project: tomee   Source File: DbcpNPEXAConnectionTest.java    License: Apache License 2.0 6 votes vote down vote up
@Configuration
public Properties props() {
    return new PropertiesBuilder()
            .p("openejb.jdbc.datasource-creator", DefaultDataSourceCreator.class.getName())

            .p("txMgr", "new://TransactionManager?type=TransactionManager")
            .p("txMgr.txRecovery", "true")
            .p("txMgr.logFileDir", "target/test/xa/DbcpNPEXAConnectionTest")

            // real XA datasources
            .p("xa", "new://Resource?class-name=" + JDBCXADataSource.class.getName())
            .p("xa.url", "jdbc:hsqldb:mem:dbcpxa")
            .p("xa.user", "sa")
            .p("xa.password", "")
            .p("xa.SkipImplicitAttributes", "true")
            .p("xa.SkipPropertiesFallback", "true") // otherwise goes to connection properties

            .p("xadb", "new://Resource?type=DataSource")
            .p("xadb.xaDataSource", "xa")
            .p("xadb.JtaManaged", "true")
            .p("xadb.MaxIdle", "25")
            .p("xadb.MaxTotal", "25")
            .p("xadb.InitialSize", "3")

            .build();
}
 
Example 5
Source Project: tomee   Source File: XADataSourceIsDifferentTest.java    License: Apache License 2.0 6 votes vote down vote up
@Configuration
public Properties config() {
    final File file = new File("target/test/xa/howl");
    if (file.isDirectory()) {
        Files.delete(file);
    }

    final Properties p = new Properties();
    p.put(DataSourceCreator.class.getName(), DbcpDataSourceCreator.class.getName()); // default dbcp pool supports xaDataSource config, not our proxy layer

    p.put("txMgr", "new://TransactionManager?type=TransactionManager");
    p.put("txMgr.txRecovery", "true");
    p.put("txMgr.logFileDir", "target/test/xa/howl");

    p.put("xa", "new://Resource?class-name=" + JDBCXADataSource.class.getName());
    p.put("xa.url", "jdbc:hsqldb:mem:xa");
    p.put("xa.user", "sa");
    p.put("xa.password", "");
    p.put("xa.SkipImplicitAttributes", "true"); // conflict with connectionProperties

    p.put("xaFacade", "new://Resource?class-name=" + IsDifferentXaDataSourceWrapper.class.getName() + "&constructor=delegate");
    p.put("xaFacade.delegate", "@xa");

    return p;
}
 
Example 6
Source Project: tomee   Source File: TomcatXADataSourceTest.java    License: Apache License 2.0 5 votes vote down vote up
@Configuration
public Properties props() {
    return new PropertiesBuilder()
            .p("openejb.jdbc.datasource-creator", TomEEDataSourceCreator.class.getName())

            .p("txMgr", "new://TransactionManager?type=TransactionManager")
            .p("txMgr.txRecovery", "true")
            .p("txMgr.logFileDir", "target/test/xa/howl")

            // real XA datasources
            .p("xa", "new://Resource?class-name=" + JDBCXADataSource.class.getName())
            .p("xa.url", "jdbc:hsqldb:mem:tomcat-xa")
            .p("xa.user", "sa")
            .p("xa.password", "")
            .p("xa.SkipImplicitAttributes", "true")
            .p("xa.SkipPropertiesFallback", "true") // otherwise goes to connection properties

            .p("xadb", "new://Resource?type=DataSource")
            .p("xadb.xaDataSource", "xa")
            .p("xadb.JtaManaged", "true")
            .p("xadb.MaxIdle", "25")
            .p("xadb.MaxActive", "25")
            .p("xadb.InitialSize", "3")

            .p("xa2", "new://Resource?class-name=" + BadDataSource.class.getName())
            .p("xa2.url", "jdbc:hsqldb:mem:tomcat-xa2")
            .p("xa2.user", "sa")
            .p("xa2.password", "")
            .p("xa2.SkipImplicitAttributes", "true")
            .p("xa2.SkipPropertiesFallback", "true") // otherwise goes to connection properties

            .p("xadb2", "new://Resource?type=DataSource")
            .p("xadb2.xaDataSource", "xa2")
            .p("xadb2.JtaManaged", "true")
            .p("xadb2.MaxIdle", "25")
            .p("xadb2.MaxActive", "25")
            .p("xadb2.InitialSize", "3")

            .build();
}
 
Example 7
Source Project: tutorials   Source File: JtaDemoApplication.java    License: MIT License 5 votes vote down vote up
private DataSource createHsqlXADatasource(String connectionUrl) throws Exception {
    JDBCXADataSource dataSource = new JDBCXADataSource();
    dataSource.setUrl(connectionUrl);
    dataSource.setUser("sa");
    BitronixXADataSourceWrapper wrapper = new BitronixXADataSourceWrapper();
    return wrapper.wrapDataSource(dataSource);
}
 
Example 8
Source Project: tomee   Source File: XADataSourceTest.java    License: Apache License 2.0 4 votes vote down vote up
@Configuration
public java.util.Properties config() {
    final File file = new File("target/test/xa/howl");
    if (file.isDirectory()) {
        Files.delete(file);
    }

    final Properties p = new Properties();
    p.put(DataSourceCreator.class.getName(), DbcpDataSourceCreator.class.getName()); // default dbcp pool supports xaDataSource config, not our proxy layer

    p.put("txMgr", "new://TransactionManager?type=TransactionManager");
    p.put("txMgr.txRecovery", "true");
    p.put("txMgr.logFileDir", "target/test/xa/howl");

    // real XA datasources
    p.put("xa", "new://Resource?class-name=" + JDBCXADataSource.class.getName());
    p.put("xa.url", "jdbc:hsqldb:mem:xa");
    p.put("xa.user", "sa");
    p.put("xa.password", "");
    p.put("xa.SkipImplicitAttributes", "true"); // conflict with connectionProperties

    p.put("xa2", "new://Resource?class-name=" + JDBCXADataSource.class.getName());
    p.put("xa2.url", "jdbc:hsqldb:mem:xa2");
    p.put("xa2.user", "sa");
    p.put("xa2.password", "");
    p.put("xa2.SkipImplicitAttributes", "true");

    // pooled "XA" datasources
    p.put("xadb", "new://Resource?type=DataSource");
    p.put("xadb.XaDataSource", "xa"); // to be xa
    p.put("xadb.JtaManaged", "true");

    p.put("xadb2", "new://Resource?type=DataSource");
    p.put("xadb2.XaDataSource", "xa2"); // to be xa
    p.put("xadb2.JtaManaged", "true");

    // non jta datasources
    p.put("xadbn", "new://Resource?class-name=" + JDBCXADataSource.class.getName());
    p.put("xadbn.JdbcDriver", jdbcDriver.class.getName());
    p.put("xadbn.url", "jdbc:hsqldb:mem:xa");
    p.put("xadbn.user", "sa");
    p.put("xadbn.password", "");

    p.put("xadbn2", "new://Resource?type=DataSource");
    p.put("xadbn2.JdbcDriver", jdbcDriver.class.getName());
    p.put("xadbn2.JdbcUrl", "jdbc:hsqldb:mem:xa2");
    p.put("xadbn2.UserName", "sa");
    p.put("xadbn2.Password", "");
    p.put("xadbn2.JtaManaged", "false");

    return p;
}
 
Example 9
Source Project: tomee   Source File: XADataSourceDefinitionTest.java    License: Apache License 2.0 4 votes vote down vote up
@Test
public void nonJta() throws Exception {
    assertTrue(JDBCXADataSource.class.isInstance(new InitialContext().lookup("java:app/xads2")));
}