Implement database import and export.

Untested yet.