Thread: dblink_connect fails

dblink_connect fails

From
venkat j
Date:
Hello All
Im trying to use dblink set of functions in PostGreSql 7.3.4. My environment is WinNT and cygwin. I try to connect to a different database using dblink_connect. In my pl/pgsql statement
 
....
perform dblink_connect(\'dbname=generic\');
.....
 
When i call this function, PostGreSql throws the following error:
 
ERROR:  dblink_connect: connection error: could not send startup packet: Transport endpoint is not connected
 
Im calling the above function from a Java program.
 
But i tried out a sample function that works fine! This sample function works fine from psql prompt and from a java program.
Can anybody help in understanding this error better?
 
Thanks in advance.


Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing

Re: dblink_connect fails

From
Joe Conway
Date:
venkat j wrote:
> .... perform dblink_connect(\'dbname=generic\'); .....
>
> When i call this function, PostGreSql throws the following error:
>
> ERROR:  dblink_connect: connection error: could not send startup
> packet: Transport endpoint is not connected

The error comes from libpq, or possibly from some other library (because
I'm not seeing it anywhere in the libpq source). You might try adding
"hostaddr=127.0.0.1" to the connect string.

> But i tried out a sample function that works fine! This sample
> function works fine from psql prompt and from a java program. Can
> anybody help in understanding this error better?

Are you sure a database named "generic" exists? What *exactly* does the
sample connect look like? Are you saying this works:
   select dblink_connect('dbname=template1');
but this doesn't:
   select dblink_connect('dbname=generic');
?

Joe