Package com.sleepycat.je

Examples of com.sleepycat.je.Environment.openDatabase()


                dbEnvConfig.setLockTimeout(5, TimeUnit.SECONDS);
                environment = new Environment(dir, dbEnvConfig);
                final DatabaseConfig dbConfig = new DatabaseConfig();
                dbConfig.setTransactional(true);
                dbConfig.setAllowCreate(true);
                database = environment.openDatabase(null, name, dbConfig);
            } catch (final Exception ex) {
                LOGGER.error("Could not create FlumePersistentManager", ex);
                // For consistency, close database as well as environment even though it should never happen since the
                // database is that last thing in the block above, but this does guard against a future line being
                // inserted at the end that would bomb (like some debug logging).
View Full Code Here


        DatabaseConfig dbConfig = new DatabaseConfig();
        dbConfig.setReadOnly(true);
        dbConfig.setTransactional(true);
        dbConfig.setAllowCreate(false);
        Transaction txn = env.beginTransaction(null, null);
        Database db = env.openDatabase(txn, DbTree.REP_GROUP_DB_NAME, dbConfig);

        DatabaseEntry groupEntry = new DatabaseEntry();
        OperationStatus status =
            db.get(txn, groupKeyEntry, groupEntry, LockMode.READ_COMMITTED);
        if (status != OperationStatus.SUCCESS) {
View Full Code Here

            DatabaseConfig dbCfg = new DatabaseConfig();
            dbCfg.setAllowCreate(false);
            dbCfg.setReadOnly(true);
            DbInternal.setUseExistingConfig(dbCfg, true);

            Database db = env.openDatabase(null, dbName, dbCfg);
            out.println("Database: " + dbName + ", Count: " + db.count());
            db.close();
        }

        env.close();
View Full Code Here

                dbEnvConfig.setLockTimeout(5, TimeUnit.SECONDS);
                environment = new Environment(dir, dbEnvConfig);
                final DatabaseConfig dbConfig = new DatabaseConfig();
                dbConfig.setTransactional(true);
                dbConfig.setAllowCreate(true);
                database = environment.openDatabase(null, name, dbConfig);
            } catch (final Exception ex) {
                LOGGER.error("Could not create FlumePersistentManager", ex);
                return null;
            }
View Full Code Here

                dbEnvConfig.setLockTimeout(5, TimeUnit.SECONDS);
                environment = new Environment(dir, dbEnvConfig);
                final DatabaseConfig dbConfig = new DatabaseConfig();
                dbConfig.setTransactional(true);
                dbConfig.setAllowCreate(true);
                database = environment.openDatabase(null, name, dbConfig);
            } catch (final Exception ex) {
                LOGGER.error("Could not create FlumePersistentManager", ex);
                return null;
            }
View Full Code Here

            try {
                env.truncateDatabase(null, DB_NAME, false);
            } catch (DatabaseNotFoundException e) {
                // ignored
            }
            Database db = env.openDatabase(null, DB_NAME, config.toDatabaseConfig());
            initialize(db);
        } catch (DatabaseException e) {
            IOException io = new IOException();
            io.initCause(e);
            throw io;
View Full Code Here

        org.archive.util.FileUtils.ensureWriteableDirectory(f);
        Environment bdbEnvironment = new Environment(f, config);
        DatabaseConfig dbConfig = new DatabaseConfig();
        dbConfig.setAllowCreate(true);
        dbConfig.setDeferredWrite(true);
        Database db = bdbEnvironment.openDatabase(null, "test", dbConfig);
       
        StoredSortedMap<String, String> ssm = new StoredSortedMap<String, String>(db, new StringBinding(), new StringBinding(), true);       
        testUrlsNoMatch(ssm);  
        db.close();
        bdbEnvironment.close();
View Full Code Here

                dbConfig.setReadOnly(readOnly);
                boolean transactional = environment.getConfig().getTransactional();
                dbConfig.setTransactional(transactional);
                dbConfig.setDeferredWrite(!transactional);

                database = environment.openDatabase(null, databaseName, dbConfig);
            } catch (RuntimeException e) {
                if (environment != null) {
                    environment.close();
                }
                throw e;
View Full Code Here

                            databaseName));
                }
            }
            DatabaseConfig dbConfig = new DatabaseConfig();
            dbConfig.setAllowCreate(true);
            Database openDatabase = environment.openDatabase(null, databaseName, dbConfig);
            openDatabase.close();
            environment.flushLog(true);
            environment.close();
            environment = createEnvironment(readOnly);
        }
View Full Code Here

            dbConfig.setReadOnly(readOnly);
            boolean transactional = environment.getConfig().getTransactional();
            dbConfig.setTransactional(transactional);
            dbConfig.setDeferredWrite(!transactional);

            database = environment.openDatabase(null, databaseName, dbConfig);
        } catch (RuntimeException e) {
            if (environment != null) {
                environment.close();
            }
            throw e;
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.