Software: Apache/2.2.22 (Debian). PHP/5.6.36 uname -a: Linux h05.hvosting.ua 4.9.110-amd64 #3 SMP Sun Nov 4 16:27:09 UTC 2018 x86_64 uid=1389(h33678) gid=1099(h33678) groups=1099(h33678),502(mgrsecure) Safe-mode: OFF (not secure) /usr/share/doc/postgresql-doc-9.1/html/ drwxr-xr-x |
Viewing file: Select action/file-type: CONNECTSynopsisCONNECT TO connection_target [ AS connection_name ] [ USER connection_user ] CONNECT TO DEFAULT CONNECT connection_user DATABASE connection_target DescriptionThe CONNECT command establishes a connection between the client and the PostgreSQL server. Parameters
ExamplesHere a several variants for specifying connection parameters: EXEC SQL CONNECT TO "connectdb" AS main; EXEC SQL CONNECT TO "connectdb" AS second; EXEC SQL CONNECT TO "unix:postgresql://200.46.204.71/connectdb" AS main USER connectuser; EXEC SQL CONNECT TO "unix:postgresql://localhost/connectdb" AS main USER connectuser; EXEC SQL CONNECT TO 'connectdb' AS main; EXEC SQL CONNECT TO 'unix:postgresql://localhost/connectdb' AS main USER :user; EXEC SQL CONNECT TO :db AS :id; EXEC SQL CONNECT TO :db USER connectuser USING :pw; EXEC SQL CONNECT TO @localhost AS main USER connectdb; EXEC SQL CONNECT TO REGRESSDB1 as main; EXEC SQL CONNECT TO AS main USER connectdb; EXEC SQL CONNECT TO connectdb AS :id; EXEC SQL CONNECT TO connectdb AS main USER connectuser/connectdb; EXEC SQL CONNECT TO connectdb AS main; EXEC SQL CONNECT TO connectdb@localhost AS main; EXEC SQL CONNECT TO tcp:postgresql://localhost/ USER connectdb; EXEC SQL CONNECT TO tcp:postgresql://localhost/connectdb USER connectuser IDENTIFIED BY connectpw; EXEC SQL CONNECT TO tcp:postgresql://localhost:20/connectdb USER connectuser IDENTIFIED BY connectpw; EXEC SQL CONNECT TO unix:postgresql://localhost/ AS main USER connectdb; EXEC SQL CONNECT TO unix:postgresql://localhost/connectdb AS main USER connectuser; EXEC SQL CONNECT TO unix:postgresql://localhost/connectdb USER connectuser IDENTIFIED BY "connectpw"; EXEC SQL CONNECT TO unix:postgresql://localhost/connectdb USER connectuser USING "connectpw"; EXEC SQL CONNECT TO unix:postgresql://localhost/connectdb?connect_timeout=14 USER connectuser;
Here is an example program that illustrates the use of host variables to specify connection parameters: int main(void) { EXEC SQL BEGIN DECLARE SECTION; char *dbname = "testdb"; /* database name */ char *user = "testuser"; /* connection user name */ char *connection = "tcp:postgresql://localhost:5432/testdb"; /* connection string */ char ver[256]; /* buffer to store the version string */ EXEC SQL END DECLARE SECTION; ECPGdebug(1, stderr); EXEC SQL CONNECT TO :dbname USER :user; EXEC SQL SELECT version() INTO :ver; EXEC SQL DISCONNECT; printf("version: %s\n", ver); EXEC SQL CONNECT TO :connection USER :user; EXEC SQL SELECT version() INTO :ver; EXEC SQL DISCONNECT; printf("version: %s\n", ver); return 0; }
|
:: Command execute :: | |
--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by PinoyWH1Z | C99Shell Github | Generation time: 0.0289 ]-- |