Backing up and restoring a schema

Having a back up of your data is an important measure in case disasters strike. Obviously we hope that they don't, but its best to be prepared.

Organisation of an IJC project

An IJC project is contained within a directory on your hard disk. Normally this will be located in a location like this (assuming you substitute username and ijc-project for the correct values):

  • Mac: /Users/username/IJCProjects/ijc-project

  • Windows XP: C:\Documents and Settings\username\My Documents\IJCProjects\ijc-project

  • Windows Vista or 7: C:\Users\username\Documents\IJCProjects\ijc-project

  • Linux: /home/username/IJCProjects/ijc-project

This entire directory, or parts of it can be copied to create a backup, or given to a colleague so that they get a copy. The project can contain normal files (e.g. PDF or Word documents), and these can be organised into directories should you need. The databases in your project are contained within a directory named .config (note the dot at the start), with each database being a configuration file, named xyz.ijs (xyz is the name of the database), and a directory named xyz.

In the case of a local database the database contents are located within the xyz directory (the real name is often localdb). In the case of a remote database only the connection details are stored in the xyz.ijs file and the xyz directory is essentially empty (but required).

The .config directory can contain multiple xyz.ijs and xyz directories, one for each database in the project.

Local databases

With local databases all data is stored on your local hard disk. You are therefore at risk if your computer has problems, such as the disk failing. Therefore making regular backups is strongly recommended. All the data for a local database is stored in files within your IJC project. Therefore backing up the database is as simple as backing up the files for the database or for the whole project.

Manual backup

To manually backup a project, locate the project folder on your hard disk, and copy it to another place (e.g. a file server). Alternatively zip up the contents and copy the zip file to another place. The backup will contain all local and all remote databases in the project.

If you need to restore the backup then reverse the process, and replace the old project, or create a new one with the copy.

To back up a single local database within a project, locate the local database directory within the project. This will be within the .config directory within the project. Then create a copy of that directory and the .ijs file, or create a zip file as described above.

Restoring the backup is again a case of reversing the process.

Using IJC to create zip file

IJC contains function to assist in generating a backup of a local directory. This involves creating or restoring a zip file of the local database.

To backup a local database : right click on the local database node in the projects window and choose 'Backup schema to ZIP file...'. You will be prompted for the file name of the zip file that will be created. If you are already connected to the database then it will be disconnected before being backed up.

To restore a local database : right click on the project node, or the empty space below the project's contents and choose 'Restore schema from ZIP backup...'. You will be prompted for the zip file to restore. If a schema with that name already exists you will be asked if you want to overwrite it. You might want to rename it beforehand instead so that it is not lost.

Some zip files can be limited in size to 4GB, so you may need to use the manual approach if your database is very large

Sending backup to colleague

One nice advantage of the local database just being a set of files and directories within the IJC project directory is that it makes it possible to transfer the entire database between computers or between users. Various approaches can be used here, but the simplest is to use IJC to create a ZIP file backup of your database, send the ZIP file to your colleague and for them to restore the backup into their IJC project. This way your colleague will get an exact copy of the database, including all data, and all forms you had created.

Remote databases

With a remote database no actual data is located within the project directory as the actual data is stored in the database itself. The project only contains the connection information for the database. Backing up the project or the xyz.ijs and xyz directory will back up these connection details, which can be useful, but it will not backup the actual data in the database. Backup of the data must be performed by your database administrator. Typically this is done automatically on a daily or weekly basis. Contact your database administrator to check this is being done. If not then all your data is at risk in cases of a disaster.

Usernames and passwords

The .ijs files can contain usernames and password for the database and for the IJC user. When creating backups or sending them to a colleague check that you are not including usernames or passwords that you did not intend to disclose.