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!

Reading Berkeley DB 1.85 file

r.borilloDec 1 2006 — edited Dec 1 2006
Hi all,

I'm trying to read a db file from my Mozilla Firefox installation and i have followed this steps:

*. Download Berkeley DB 4.5.20
*. Install distribution from "build_unix" directory:

../dist/configure enable-java enable-compat185
make
sudo make install

The, I have implemented a Java Test like this:

import java.io.FileNotFoundException;
import com.sleepycat.db.Database;
import com.sleepycat.db.DatabaseConfig;
import com.sleepycat.db.DatabaseException;
import com.sleepycat.db.DatabaseType;

public class Test
{
public static void main(String[] args) throws FileNotFoundException, DatabaseException
{
DatabaseConfig dbConfig = new DatabaseConfig();
dbConfig.setErrorStream(System.err);
dbConfig.setType(DatabaseType.HASH);
dbConfig.setAllowCreate(false);

Database table = new Database("/tmp/cert8.db", null, dbConfig);
}
}

And when i execute:

java -Djava.library.path=/usr/local/BerkeleyDB.4.5/lib -classpath .:/opt/jar-libs/db.jar Test

I get:

/tmp/cert8.db: unexpected file type or format
Exception in thread "main" java.lang.IllegalArgumentException: Invalid argument
at com.sleepycat.db.internal.db_javaJNI.Db_open(Native Method)
at com.sleepycat.db.internal.Db.open(Db.java:337)
at com.sleepycat.db.DatabaseConfig.openDatabase(DatabaseConfig.java:500)
at com.sleepycat.db.Database.<init>(Database.java:39)
at db.Test.main(Test.java:25)

In my linux box, if i issue "file" unix command, i get:

$ file /tmp/cert8.db
/tmp/cert8.db: Berkeley DB 1.85 (Hash, version 2, native byte-order)

If i have built the distribution with --enable-compat185, Why i can read this file?

Thanks a lot
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 29 2006
Added on Dec 1 2006
3 comments
2,878 views