Examples of EmbeddedDataSource


Examples of org.apache.derby.jdbc.EmbeddedDataSource

        System.setProperty("derby.storage.fileSyncTransactionLog", "true");

        // load the Embedded driver to initialize the home
        new org.apache.derby.jdbc.EmbeddedDriver();

        EmbeddedDataSource datasource = new EmbeddedDataSource();
        datasource.setDatabaseName("SystemDatabase");
        datasource.setCreateDatabase("create");
        try {
            Connection c = datasource.getConnection();
            c.close();
        } catch (SQLException e) {
            while (e.getNextException() != null) {
                e.printStackTrace();
                e = e.getNextException();
View Full Code Here

Examples of org.apache.derby.jdbc.EmbeddedDataSource

public class DbRestartJDBCQueueMasterSlaveTest extends JDBCQueueMasterSlaveTest {
    private static final transient Log LOG = LogFactory.getLog(DbRestartJDBCQueueMasterSlaveTest.class);
   
    protected void messageSent() throws Exception {   
        if (++inflightMessageCount == failureCount) {
            final EmbeddedDataSource ds = getExistingDataSource();
            ds.setShutdownDatabase("shutdown");
            LOG.info("DB STOPPED!@!!!!");
           
            Thread dbRestartThread = new Thread("db-re-start-thread") {
                public void run() {
                    LOG.info("Waiting for master broker to Stop");
                    master.waitUntilStopped();
                    ds.setShutdownDatabase("false");
                    LOG.info("DB RESTARTED!@!!!!");
                }
            };
            dbRestartThread.start();
        }
View Full Code Here

Examples of org.apache.derby.jdbc.EmbeddedDataSource

    JDBCPersistenceAdapter jdbc;

    @Override
    protected PersistenceAdapter createPersistenceAdapter(boolean delete) throws Exception {
        jdbc = new JDBCPersistenceAdapter();
        dataSource = new EmbeddedDataSource();
        dataSource.setDatabaseName("derbyDb");
        dataSource.setCreateDatabase("create");
        dataSource.setShutdownDatabase(null);
        jdbc.setDataSource(dataSource);
        jdbc.deleteAllMessages();
View Full Code Here

Examples of org.apache.derby.jdbc.EmbeddedDataSource

    private static final transient Logger LOG = LoggerFactory.getLogger(DbRestartJDBCQueueMasterSlaveTest.class);
   
    protected void messageSent() throws Exception {   
        if (++inflightMessageCount == failureCount) {
            LOG.info("STOPPING DB!@!!!!");
            final EmbeddedDataSource ds = getExistingDataSource();
            ds.setShutdownDatabase("shutdown");
            LOG.info("DB STOPPED!@!!!!");
           
            Thread dbRestartThread = new Thread("db-re-start-thread") {
                public void run() {
                    LOG.info("Waiting for master broker to Stop");
                    master.waitUntilStopped();
                    ds.setShutdownDatabase("false");
                    LOG.info("DB RESTARTED!@!!!!");
                }
            };
            dbRestartThread.start();
        }
View Full Code Here

Examples of org.apache.derby.jdbc.EmbeddedDataSource

    @Override
    protected void messageSent() throws Exception {   
        if (++inflightMessageCount == failureCount) {
            LOG.info("STOPPING DB!@!!!!");
            final EmbeddedDataSource ds = sharedDs;
            ds.setShutdownDatabase("shutdown");
            try {
                ds.getConnection();
            } catch (Exception ignored) {
            }
            LOG.info("DB STOPPED!@!!!!");
           
            Thread dbRestartThread = new Thread("db-re-start-thread") {
                public void run() {
                    LOG.info("Sleeping for 10 seconds before allowing db restart");
                    try {
                        restartDBLatch.await(10, TimeUnit.SECONDS);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    ds.setShutdownDatabase("false");
                    LOG.info("DB RESTARTED!@!!!!");
                }
            };
            dbRestartThread.start();
        }
View Full Code Here

Examples of org.apache.derby.jdbc.EmbeddedDataSource

    EmbeddedDataSource dataSource;

    @Override
    protected PersistenceAdapter createPersistenceAdapter(boolean delete) throws Exception {
        JDBCPersistenceAdapter jdbc = new JDBCPersistenceAdapter();
        dataSource = new EmbeddedDataSource();
        dataSource.setDatabaseName("derbyDb");
        dataSource.setCreateDatabase("create");
        dataSource.setShutdownDatabase(null);
        jdbc.setDataSource(dataSource);
        jdbc.deleteAllMessages();
View Full Code Here

Examples of org.apache.derby.jdbc.EmbeddedDataSource

    protected BrokerService createBroker() throws Exception {

        BrokerService broker = new BrokerService();
        jdbc = new BrokenPersistenceAdapter();

        dataSource = new EmbeddedDataSource();
        dataSource.setDatabaseName("target/derbyDb");
        dataSource.setCreateDatabase("create");

        jdbc.setDataSource(dataSource);
        jdbc.setUseDatabaseLock(false);
View Full Code Here

Examples of org.apache.derby.jdbc.EmbeddedDataSource

public class JDBCNetworkBrokerDetachTest extends NetworkBrokerDetachTest {

    protected void configureBroker(BrokerService broker) throws Exception {
        JDBCPersistenceAdapter jdbc = new JDBCPersistenceAdapter();
        EmbeddedDataSource dataSource = new EmbeddedDataSource();
        dataSource.setDatabaseName(broker.getBrokerName());
        dataSource.setCreateDatabase("create");
        jdbc.setDataSource(dataSource);
        jdbc.deleteAllMessages();
        broker.setPersistenceAdapter(jdbc);
    }
View Full Code Here

Examples of org.apache.derby.jdbc.EmbeddedDataSource

        // Setup the Derby datasource.
        System.setProperty("derby.system.home", getDataDirectoryFile().getCanonicalPath());
        System.setProperty("derby.storage.fileSyncTransactionLog", "true");
        System.setProperty("derby.storage.pageCacheSize", "100");

        final EmbeddedDataSource ds = new EmbeddedDataSource();
        ds.setDatabaseName("derbydb");
        ds.setCreateDatabase("create");
        return ds;
    }
View Full Code Here

Examples of org.apache.derby.jdbc.EmbeddedDataSource

*/
public class JDBCDurableSubscriptionTest extends DurableSubscriptionTestSupport {

    protected PersistenceAdapter createPersistenceAdapter() throws IOException {
        JDBCPersistenceAdapter jdbc = new JDBCPersistenceAdapter();
        EmbeddedDataSource dataSource = new EmbeddedDataSource();
        dataSource.setDatabaseName("derbyDb");
        dataSource.setCreateDatabase("create");
        jdbc.setDataSource(dataSource);
        jdbc.setCleanupPeriod(1000); // set up small cleanup period
        return jdbc;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.