postgresql/contrib/dblink/doc/connection

76 lines
1.4 KiB
Plaintext
Raw Normal View History

2002-09-02 14:32:41 +08:00
==================================================================
Name
dblink_connect -- Opens a persistent connection to a remote database
Synopsis
dblink_connect(text connstr)
dblink_connect(text connname, text connstr)
2002-09-02 14:32:41 +08:00
Inputs
connname
if 2 arguments are given, the first is used as a name for a persistent
connection
2002-09-02 14:32:41 +08:00
connstr
standard libpq format connection string,
e.g. "hostaddr=127.0.0.1 port=5432 dbname=mydb user=postgres password=mypasswd"
if only one argument is given, the connection is unnamed; only one unnamed
connection can exist at a time
2002-09-02 14:32:41 +08:00
Outputs
Returns status = "OK"
Example usage
select dblink_connect('dbname=postgres');
dblink_connect
----------------
OK
(1 row)
select dblink_connect('myconn','dbname=postgres');
2002-09-02 14:32:41 +08:00
dblink_connect
----------------
OK
(1 row)
==================================================================
Name
dblink_disconnect -- Closes a persistent connection to a remote database
2002-09-02 14:32:41 +08:00
Synopsis
dblink_disconnect()
dblink_disconnect(text connname)
2002-09-02 14:32:41 +08:00
Inputs
connname
if an argument is given, it is used as a name for a persistent
connection to close; otherwiase the unnamed connection is closed
2002-09-02 14:32:41 +08:00
Outputs
Returns status = "OK"
Example usage
test=# select dblink_disconnect();
dblink_disconnect
-------------------
OK
(1 row)
select dblink_disconnect('myconn');
dblink_disconnect
-------------------
OK
(1 row)