Finally got the database connection working