Search in sources :

Example 1 with EmbeddedDriver

use of org.apache.derby.jdbc.EmbeddedDriver in project camel by apache.

the class DatabaseInitializationBean method create.

public void create() throws Exception {
    LOG.info("Creating database tables ...");
    if (connection == null) {
        EmbeddedDriver driver = new EmbeddedDriver();
        connection = driver.connect(url + ";create=true", null);
    }
    String sql = "create table ORDERS (\n" + "  ORD_ID integer primary key,\n" + "  ITEM varchar(10),\n" + "  ITEM_COUNT varchar(5),\n" + "  ITEM_DESC varchar(30),\n" + "  ORD_DELETED boolean\n" + ")";
    try {
        execute("drop table orders");
    } catch (Throwable e) {
    // ignore
    }
    execute(sql);
    LOG.info("Database tables created");
}
Also used : EmbeddedDriver(org.apache.derby.jdbc.EmbeddedDriver)

Example 2 with EmbeddedDriver

use of org.apache.derby.jdbc.EmbeddedDriver in project aries by apache.

the class DerbyActivator method start.

public void start(BundleContext context) throws Exception {
    new EmbeddedDriver();
    context.registerService(DataSourceFactory.class.getName(), this, new Properties());
}
Also used : DataSourceFactory(org.osgi.service.jdbc.DataSourceFactory) Properties(java.util.Properties) EmbeddedDriver(org.apache.derby.jdbc.EmbeddedDriver)

Example 3 with EmbeddedDriver

use of org.apache.derby.jdbc.EmbeddedDriver in project jackrabbit by apache.

the class BackwardsCompatibilityIT method testBackwardsCompatibility.

public void testBackwardsCompatibility() throws Exception {
    // Force loading of the Derby JDBC driver
    new EmbeddedDriver();
    File target = new File("target/backwards-compatibility-test");
    FileUtils.deleteDirectory(target);
    target.mkdirs();
    File source = new File("src/test/resources/compatibility.zip");
    unpack(source, target);
    for (File dir : target.listFiles()) {
        if (dir.isDirectory()) {
            log.info("Testing backwards compatibility with {}", dir);
            checkJackrabbitRepository(dir);
            NodeStore store = new SegmentNodeStore();
            RepositoryUpgrade.copy(dir, store);
            checkRepositoryContent(new Jcr(new Oak(store)).createRepository());
        }
    }
}
Also used : NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) SegmentNodeStore(org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore) Jcr(org.apache.jackrabbit.oak.jcr.Jcr) Oak(org.apache.jackrabbit.oak.Oak) SegmentNodeStore(org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore) EmbeddedDriver(org.apache.derby.jdbc.EmbeddedDriver) ZipFile(java.util.zip.ZipFile) File(java.io.File)

Aggregations

EmbeddedDriver (org.apache.derby.jdbc.EmbeddedDriver)3 File (java.io.File)1 Properties (java.util.Properties)1 ZipFile (java.util.zip.ZipFile)1 Oak (org.apache.jackrabbit.oak.Oak)1 Jcr (org.apache.jackrabbit.oak.jcr.Jcr)1 SegmentNodeStore (org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore)1 NodeStore (org.apache.jackrabbit.oak.spi.state.NodeStore)1 DataSourceFactory (org.osgi.service.jdbc.DataSourceFactory)1