Unable to select database from connect function