From: | Michael Fuhr <mike(at)fuhr(dot)org> |
---|---|
To: | Michael Meskes <meskes(at)postgresql(dot)org>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Connection string |
Date: | 2006-08-11 13:01:55 |
Message-ID: | 20060811130155.GA23630@winnie.fuhr.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, Aug 11, 2006 at 11:58:16AM +0200, Michael Meskes wrote:
> > EXEC SQL CONNECT TO 'tcp:postgresql://192.168.0.123/xyz' USER jsb
>
> The correct syntax would be:
>
> EXEC SQL CONNECT TO tcp:postgresql://192.168.0.123/xyz USER jsb;
The ECPG "Connecting to the Database Server" documentation does
have an example for Unix sockets with quotes:
EXEC SQL CONNECT TO 'unix:postgresql://sql.mydomain.com/mydb' AS myconnection USER john;
Should that be changed? It's wrong on two counts as far as
I can tell: with quotes the connection fails with a server
error of
FATAL: database "'unix:postgresql://sql.mydomain.com/mydb'" does not exist
Without quotes the ECPG preprocessor fails with
ERROR: unix domain sockets only work on 'localhost' but not on 'sql.mydom'
I'm thinking that example should be:
EXEC SQL CONNECT TO unix:postgresql://localhost/mydb AS myconnection USER john;
Also, among the target formats the documentation includes:
* an SQL string literal containing one of the above forms
and the following paragraph says:
In practice, it is probably less error-prone to use a (single-quoted)
string literal or a variable reference.
which might be the source of confusion here.
--
Michael Fuhr
From | Date | Subject | |
---|---|---|---|
Next Message | Alban Hertroys | 2006-08-11 13:04:07 | Re: Help. |
Previous Message | pedro.baldanta | 2006-08-11 12:55:28 | Help. |