Port to database barclamp

A good part of this was made by Ralf Haferkamp <rhafer@suse.de>