connects to a database