Add function to check user connection to database