Search in sources :

Example 1 with HsqldbDatabaseType

use of com.j256.ormlite.db.HsqldbDatabaseType in project BachelorPraktikum by lucasbuschlinger.

the class VaultDAO method initDb.

/**
 * Initializes the actual database as a {@link JdbcConnectionSource}.
 *
 * @throws SQLException Thrown if the database can not be successfully initialized.
 */
private void initDb() throws SQLException {
    // create a connection source to our database
    connectionSource = new JdbcConnectionSource(DATABASE_URL, "sa", "", new HsqldbDatabaseType());
    // instantiate the DAO
    vaultDao = DaoManager.createDao(connectionSource, VaultEntry.class);
    if (!vaultDao.isTableExists()) {
        TableUtils.createTableIfNotExists(connectionSource, VaultEntry.class);
    } else {
        LOG.warning("Found existing DB for VaultEntries. Reusing it!!");
    }
// TableUtils.createTableIfNotExists(connectionSource, SliceEntry.class);
}
Also used : VaultEntry(de.opendiabetes.vault.container.VaultEntry) JdbcConnectionSource(com.j256.ormlite.jdbc.JdbcConnectionSource) HsqldbDatabaseType(com.j256.ormlite.db.HsqldbDatabaseType)

Aggregations

HsqldbDatabaseType (com.j256.ormlite.db.HsqldbDatabaseType)1 JdbcConnectionSource (com.j256.ormlite.jdbc.JdbcConnectionSource)1 VaultEntry (de.opendiabetes.vault.container.VaultEntry)1