Create and test database connection