Added function to connect to DB

Signed-off-by: Tanya Gray <tanyagray.nz@gmail.com>