Database connection and test script