How to connect to a Berkeley DB using JDBC?

2019-05-29 01:21发布

问题:

I have a Berkeley DB on a local folder and I'd like to connect to it via JDBC. Specifically via Zentus SqliteJDBC.

My problem is with the connection string ("url"). While a sqlite connection string might look like: "jdbc:sqlite:c:\\path\\to\\database.db", Berkeley DB does not have a single .db file to refer to. Instead, I see multiple .jdb files that make up the DB.

My questions is - What should my connection string look like?

回答1:

Berkeley DB is certified against the CH-Werner JDBC driver. The primary differences between the Zentus driver and the Ch-Werner driver is the Zentus driver is a full java implementation while the Ch-Werner is a C implementation with a JNI layer.

You can post your question over on the BDB forums and it is possible that someone might have the specific instructions for connection with the Zentus driver. There is technological reason why this would not work.

The BDB build and installation guide has specific instructions on how to connect with Ch-Werner driver. See http://docs.oracle.com/cd/E17076_02/html/installation/index.html. Section 5 has info on building for Windows and section 7 has info on building for Linux. Look for building/using the JDBC driver.