Database wrapper and test script