preparing database connection