Properly connect to a pgsql server