Moving to 4.7: How to backup and restore DEX? with Java

0 views
Skip to first unread message

DEX graphdb

unread,
Feb 14, 2013, 9:05:08 AM2/14/13
to
If you already have constructed your database with older versions of DEX but want to move to the new 4.7 version, you do not have to rebuild your database but back it up in your current version and restore it afterwards with DEX newest version.

To backup the database is as quick as doing this:

        // Open the database
        DexConfig cfg = new DexConfig();
        Dex dex = new Dex(cfg);
        Database db = dex.open("HelloDex.dex", false);
        Session sess = db.newSession();
        Graph g = sess.getGraph();

        // Save a backup
        g.backup("HelloDex.backup");

        // Close the database
        sess.close();
        db.close();
        dex.close();

And then to restore it you have to:

        // Restore the backup
        dex = new Dex(cfg);
        db = dex.restore("HelloDex.dex", "HelloDex.backup");
        sess = db.newSession();
        g = sess.getGraph();

        // The database is open again, but the object identifiers may have changed.

Reply all
Reply to author
Forward
0 new messages