Added methods for connecting to the database.