added code for connection to database