implemented database connection