【发布时间】:2018-05-22 13:04:32
【问题描述】:
我正在尝试读取生成的数据库 (*.jdb) 文件。
为了创建我使用的新数据库:
storeConfig_ = new StoreConfig();
storeConfig_.setAllowCreate(true);
我必须传入哪些 StoreConfig 参数才能读取已经存在的 *.jdb 文件?
【问题讨论】:
标签: java berkeley-db-je
我正在尝试读取生成的数据库 (*.jdb) 文件。
为了创建我使用的新数据库:
storeConfig_ = new StoreConfig();
storeConfig_.setAllowCreate(true);
我必须传入哪些 StoreConfig 参数才能读取已经存在的 *.jdb 文件?
【问题讨论】:
标签: java berkeley-db-je
然后就可以使用索引访问数据库了。
EnvironmentConfig envConfig = new EnvironmentConfig();
try {
myDbEnvironment_ = new Environment(new File(getDatabasePathString()), envConfig);
} catch (DatabaseException e) {
e.printStackTrace();
}
DAO.store_ = new EntityStore(environment, "EntityStore", new StoreConfig());
Index_ = store_.getPrimaryIndex(String.class, Page.class);
【讨论】: