can't locate db4o database file

2019-03-04 15:07发布

问题:

Hello I'm coding a simple CRUDE application that runs perfectly using JSF and DB4O. I can add and list all the entities normally without errors. I've used this code to persist the entities

bd = Db4oEmbedded.openFile(configuration, "db.data");
        bd.store(client);
        bd.commit();

the problem is that I cant locate the db.data file. I,ve done a search in the whole PC and still cant find it. soo where DB4O store those entities, how is it possible?? thank you.

回答1:

It must be in your project execution path. Usually db4o file name is called with extension yap. Better you can use relative path to the database file like

String dbPath = "c:/db/project.yap"; // better read from project resource
EmbeddedObjectContainer openFile = Db4oEmbedded.openFile(dbPath);