Connecting to database.