ObjectDB ObjectDB

Changing from client server to embedded mode

#1

Hi,

I have created a java web application and used ObjectDB in client Server mmode. It worked as per my expection.

In Client server mode I used

    Persistence.createEntityManagerFactory(
        "objectdb://localhost/myDB.odb;user=admin;password=admin");

Now to switch to embedded mode, I have tried following things

    Persistence.createEntityManagerFactory("objectdb://localhost/myDB.odb");
        //Gives Failed to connect to server localhost:6136

When I use

    Persistence.createEntityManagerFactory("$objectdb/db/myDB.odb");
        // Connect but not fetches the object stored in Client Server mode.

kindly provide information how to switch from client server mode to embedded mode. As I already have plenty of data in Client Server mode I want to use it.

edit
delete
#2

The database file format in client-server mode and embedded mode is the same, so it should be easy to move between the two modes.

Your last connection url ("$objectdb/db/myDB.odb") is valid in embedded mode. But you should be aware that it is relative to the location of the objectdb.jar that is currently in use, so if you have a new objectdb.jar copy in your project, the path will be relative to it and you will have to copy your database file into the new location.

After finding the location of the database file (from the client-server session) on your computer (under objectdb/db), you can also use an absolute path to that file as a connection url.

ObjectDB Support
edit
delete

Reply

To post on this website please sign in.