Search code examples
berkeley-db

About Berkeley DB - creating the environment home


I have started playing around with Berkeley DB. This one is really interesting, but I am facing one problem. While creating the Environment we create it like this -

Environment env = new Environment(new File("./bdb"), envConfig);

It initially threw an exception saying "bdb" location was not found. I created the location and it all worked.

My question is how would I set up berkeley DB to create this directory for me if it does not exist. I actually checked at the config method SetAllowCreate(boolean flag) .. but its functionality is different.

Any help would be appreciated. Thanks.


Solution

  • I actually ended up doing something like this (not sure whether it is right solution but it works)

    boolean x = new file("./bdb.data").mkdir();
    Environment env = new Environment(new File("./bdb"), envConfig);