connects to database server