开发者

BerkeleyDB database file opening (java)

I have a BerkeleyDB database with a .tld extension (eBay Turbolister file). Linux command 'file' confirms this is a BerkeleyDB database.

I am following the tutorial at http://download.oracle.com/docs/cd/E17277_02/html/collections/tutorial/opendbenvironment.html.

The com.sleepycat.je.Environment constructor accepts a directory, not a file. Reading a little, I found this directory is supposed to contain the database file and other files such as logs.

My question is: how do I specify the filename of the database to open - or does the database file need to have a specific filename? Second, does the file need to be in its own dir?


Some complimentary information to the answer below I found after browsing the API JavaDoc:

com.s开发者_开发知识库leepycat.je.Environment has the following method that accepts a filename:

public Database openDatabase(Transaction txn,
                             String databaseName,
                             DatabaseConfig dbConfig)


The tutorial you mentioned is for the Java Edition of Berkeley DB. Are you sure that your database file is created with the Java Edition?

The native version of Berkeley DB has also a Java binding but uses the native libraries. Maybe this fits better?

Included in the native version are command line tools like db_stat and db_verify. You can use these tools to check your file without the need to write a program.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜