CONNECT CLPPlus command
The CONNECT CLPPlus command changes the user ID connected to a database, connects to a different database, or does both. The command also displays the result of the change.
This command must be run from the CLPPlus interface.
- Specifies the user ID to connect to the database.
- Specifies the password that corresponds to the user ID.
- Specifies the name of the computer on which the database is located. For example, for a computer that is named ascender, specify @ascender.
- Specifies the name of a variable, which contains CLPPlus related information. This variable can define connection string type information and must be defined in a file that is called login.sql, which is read by the CLPPlus interface during start-up.
- Specifies the port number that receives connections on the computer where the database server is installed. The default is 50000.
- Specifies the database name to which the connection is made. The default is SAMPLE.
- Specifies the current operating system login user ID is used to connect to the database.
- Specifies the database connection information is read from the IBM® data server driver configuration
file (db2dsdriver.cfg) with
alias name dsn_alias. If dsn_alias is
not found in the IBM data server
driver configuration file, the string dsn_alias is
used as a database name and all other connection parameters are obtained
you configure an LDAP directory server in the specified IBM data server driver configuration file, the
following steps apply:
Note: CLPPlus supports connection attempts to databases with DSN aliases and the authentication mechanism that is defined in the IBM data server driver configuration. If you do not define an authentication mechanism in the IBM data server driver configuration file, a default authentication mechanism is used by CLPPlus. The default authentication mechanism is equivalent to that of JCC.
- The database connection information is read from the DSN entry with alias name dsn_alias in the IBM data server driver configuration file.
- If dsn_alias is not found in the IBM data server driver configuration file, the configured LDAP Directory server is searched for an entry with the name dsn_alias.
- If dsn_alias is not found on the LDAP Directory server, dsn_alias is used as a database name and all other connection parameters are obtained interactively.
In the following example, the database connection is changed to database Db2® on the local host at port 5445 with user name smith:
SQL> CONNECT smith/mypassword@localhost:5445/db2 Connected to CLPlus 188.8.131.52 (localhost:5445/db2) AS smith
In the same session, the connection is changed to the user name CLPPlus. For this connection, localhost, 5444, and Db2 are maintained as the host, port, and database values.
SQL> CONNECT CLPPlus/password Connected to CLPPlus 184.108.40.206 (localhost:5444/db2) AS CLPPlus
SQL> CONNECT /
SQL> CONNECT db2admin@data_dsn
define connStr = localhost:50000/sampleand can be used in the CONNECT CLPPlus command as follows:
A connection by the db2admin user is attempted on the sample database on the localhost, which has a listener port number of 50000.
SQL> CONNECT db2admin@connStr