Search Postgresql Archives

Re: Connection string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux