tdbc::postgres(n)
π NAME: tdbc::postgres(n) β the TDBC-POSTGRES bridge π
Okay bestie, meet tdbc::postgres: the TDBC-POSTGRES bridge. It's the Tcl Database Connectivity situation that lets your Tcl script vibe with a Postgres database. No cap. π
β¨ SYNOPSIS β¨
package require tdbc::postgres 1.0
tdbc::postgres::connection create db ?-option value...?
tdbc::postgres::connection new ?-option value...?
π¦ DESCRIPTION π¦
The tdbc::postgres driver gives you a database interface that conforms to Tcl DataBase Connectivity (TDBC), and it lets a Tcl script connect to a Postgres database. It's giving "your Tcl script can talk to Postgres" energy, fr fr.
You establish a connection to a POSTGRES database by invoking tdbc::postgres::connection create, passing it the name to give the database handle and a set of -option-value pairs. The available options are enumerated under CONNECTION OPTIONS below. As an alternative, tdbc::postgres::connection new may be used to create a database connection with an automatically assigned name. The return value from tdbc::postgres::connection new is the name that was chosen for the connection handle.
The side effect of tdbc::postgres::connection create is to create a new database connection.. (yes, two dots, I'm just the messenger π). See tdbc::connection(n) for the details of how to use the connection to manipulate a database.
π CONNECTION OPTIONS π
The tdbc::postgres::connection create object command supports the -encoding, -isolation, -readonly and -timeout options common to all TDBC drivers. The -timeout option will only affect connection process, once connected this value will be ignored and cannot be changed after connecting.
In addition, the following options are recognized (these options must be set on the initial creation of the connection; they cannot be changed after connecting):
-hosthostnameβ Connects to the host specified by hostname. Default is to connect using a local Unix domain socket.-hostaddraddressβ Connects to the host specified by given IP address. If both-hostand-hostaddrare given, the value of-hostis ignored. Default is to connect using a local Unix domain socket.-portnumberβ Connects to a Postgres server listening on the port specified by number. It is used only whenhostorhostaddris specified.-usernameβ Presents name as the user name to the Postgres server. Default is the current user ID.-passwdpassword,-passwordpasswordβ These two options are synonymous. They present the given password as the user's password to the Postgres server. Default is not to present a password.-databasename,-dbnameβ These two options are synonymous. They present the given name as the name of the default database to use in Postgres queries. If not specified, the default database for the current user is used.-optionsoptsβ This setsoptsas additional command line options send to the server.-ttyfileβ This option is ignored on never servers. Formerly this specified where to send debug output. This option is left for compatibility with older servers.-sslmodemodeβ This option determines whether or with what priority an SSL connection will be negotiated with the server. There are four modes:disableβ will attempt only an unencrypted SSL connectionallowβ will negotiate, trying first a non-SSL connection, then if that fails, trying an SSL connectionprefer(the default) β will negotiate, trying first an SSL connection, then if that fails, trying a regular non-SSL connectionrequireβ will try only an SSL connection If PostgreSQL is compiled without SSL support, using optionrequirewill cause an error, and optionsallowandpreferwill be tolerated but the driver will be unable to negotiate an SSL connection.
-requiresslβ This option is deprecated in favor of the-sslmodesetting. The flag value must be a Boolean value. If it is true (or any equivalent), driver will then refuse to connect if the server does not accept an SSL connection. The default value is false (or any equivalent), and acts the same like-sslmode preffered.-serviceβ It specifies a service name inpg_service.conffile that holds additional connection parameters. This allows applications to specify only a service name so connection parameters can be centrally maintained. Refer to PostgreSQL Documentation orPREFIX/share/pg_service.conf.samplefile for details.
π EXAMPLES π
tdbc::postgres::connection -user joe -passwd sesame -db joes_database
Connects to the Postgres server on the local host using the default connection method, presenting user ID joe and password sesame. Uses joes_database as the default database name.
π«Ά SEE ALSO π«Ά
tdbc(n), tdbc::connection(n), tdbc::resultset(n), tdbc::statement(n)
π KEYWORDS π
TDBC, SQL, Postgres, database, connectivity, connection
πΈ COPYRIGHT πΈ
Copyright (c) 2009 by Slawomir Cygan
That's the whole page, bestie π. Footer sign-off vibes: Tcl 8.6 and tdbc::postgres(n) β no date was printed on this footer, so I'm not inventing one π. Stay slay, and may your connections be iconic. β¨
π¦ where this page comes from
- alpine 3.22: tcl-doc 8.6.16-r0 Β· TCL
- alpine 3.23: tcl-doc 8.6.17-r0 Β· TCL
- alpine 3.23: tcl9-doc 9.0.3-r0 Β· TCL
- alpine 3.24: tcl-doc 8.6.17-r1 Β· TCL
- alpine 3.24: tcl9-doc 9.0.3-r2 Β· TCL
- arch rolling: tcl 8.6.16-1 Β· TCL
- nixos 26.05: tcl 9.0.3
- nixpkgs unstable: tcl 9.1.0
- opensuse-leap 16.0: tcl 8.6.15-160000.2.2 Β· TCL
- opensuse-leap 16.0: tcl 8.6.15-160000.2.2 Β· TCL
- opensuse-leap 16.0: tcl 8.6.15-160000.2.2 Β· TCL
- opensuse-leap 16.0: tcl 8.6.15-160000.2.2 Β· TCL
- Copyright (c) 2009 by Slawomir Cygan
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms