Name

database

database options

This command is used to connect to a database and to query and change information related to database sources

database [connect] id datasource [userid] [password]

Open a connection to a database, creating a database object named id (a new Tcl command) used to access the database. Accepts the datasource name (DSN) and optionally a user ID and password, returning the database ID. The connect keyword is optional.

Example

database db employeebase sysadm xxxxxx
database [connect] id connectionstring

An alternate form of the connect command that accepts a string of attribute-value pairs in the form Attribute1=Value1 Attribute2=Value2.

Example

database db "DRIVER=Microsoft Paradox Driver (*.db);DBQ=C:\\db"
database configure operation driver attributes

Configure an ODBC datasource. The operation parameter is one of the values in the following list. The driver parameter is the name of the ODBC driver to be used. The attributes argument is a driver-specific list of name and value pairs. Does not open a connection to the database.

Operations

add_dsn

Add a datasource for the current user.

config_dsn

Configure a datasource.

remove_dsn

Remove the datasource.

add_sys_dsn

Add a system datasource, visible to all users.

config_sys_dsn

Configure a system datasource.

remove_sys_dsn

Remove a system datasource.

database datasources

Return a list of configured ODBC datasources. Each element is a list consisting of the datasource name and the driver name.

database drivers

Return a list of configured ...

Get Tcl/Tk in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.