Added command-line setting of variables, attempt to connect, corrected PG syntax