System.setProperty("derby.storage.fileSyncTransactionLog", "true");
EmbeddedDataSource ds = new EmbeddedDataSource();
ds.setDatabaseName("derbydb");
ds.setCreateDatabase("create");
JDBCPersistenceAdapter jdbcAdapter = new JDBCPersistenceAdapter();
jdbcAdapter.setDataSource(ds);
// Setup the Journal
File journalDir = new File(dataDirectory, "journal");
JournalPersistenceAdapter journalAdapter = new JournalPersistenceAdapter(journalDir, jdbcAdapter);
journalAdapter.setJournalType(JournalPersistenceAdapter.DEFAULT_JOURNAL_TYPE);