Tutorials
   
 

Database Backups.

Chronus 2.0 now includes a tool for backing up any kind of map to a .zip file, and re-loading that exported .zip into any map.

Our first example covers backing up a chronus databases.

Chronus db = new Chronus();
db.put("Key", "Value");
chronus.Tools.exportDatabase(db, "backup.zip");

//Next up we might want to get the zip back into our database

chronus.Tools.importDatabase(db, "backup.zip");

So, as you can see, importDatabase and exportDatabase handles most of our backing up needs, but what happens when we want to, let's say only backup daily objects for a certain month?

Our following example covers backing up other map-implementing objects, as well as exporting only certain keys from your database.

//Create our chronus object as well as a hashtable
Chronus db = new Chronus();
Hashtable ht = new Hashtable();

ht.put("July1", db.get("July1"));
ht.put("July2", db.get("July2"));
ht.put("July1", db.get("July3")); //and so fourth...

chronus.Tools.exportDatabase(ht, "backup.zip");

Notice that were backing up a hashtable to zip, we can do this since both chronus and hashtables are maps.

So that covers the use of Chronus's backup system.

Back