Add database connect function