Skip to Main Content

Berkeley DB Family

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

duplicatesAllowed configuration error

2702412Jun 26 2014 — edited Jun 26 2014

I am newbie to Berkely DB.I have written a simple program to read and write from the DB and use secondary database.

when i run this code the following error occur

"You can't open a Database with a duplicatesAllowed configuration of true if the underlying database was created with a duplicatesAllowedSetting of false"


    public LocalDataBase(String homeDir) throws DatabaseException, FileNotFoundException{

        EnvironmentConfig conf = new EnvironmentConfig();

        conf.setTransactional(true);

        conf.setAllowCreate(true);

        env = new Environment(new File(homeDir), conf);

       

        DatabaseConfig  dbConf = new DatabaseConfig();

        dbConf.setTransactional(true);

        dbConf.setAllowCreate(true);

        Database catdb = env.openDatabase(null, CLASS_CATALOG, dbConf);

        javaCatalog = new StoredClassCatalog(catdb);

       

        metadataDb = env.openDatabase(null, METADATA_STORE, dbConf);

       

          // begin of secondary section

        SecondaryConfig secConf = new SecondaryConfig();

        secConf.setTransactional(true);

        secConf.setAllowCreate(true);

        secConf.setSortedDuplicates(true);

       

        secConf.setKeyCreator(new MetsdataSecondaryKeyCreator(

                    this.javaCatalog, MetadataKey.class,

                    MetadataValue.class, String.class));

        metadataByUserAndKeyDb = env.openSecondaryDatabase(null,

                METADATA_SECONDARY_INDEX, metadataDb, secConf);

          // end of secondary section

    }

notice: this is true without socondary section

please help me.

Comments

Processing
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jul 24 2014
Added on Jun 26 2014
1 comment
1,179 views