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.
Invocation
This command must be run from the CLPPlus interface.
Authorization
None
Required connection
None
Command syntax
Command parameters
- ACCESSTOKEN accesstoken-str
- Identifies the token used for authentication at the server. Specifying an access token is only valid if the negotiated authentication type for the connection is TOKEN or GSSAPI. If the negotiated authentication type is TOKEN, then accesstokentype must also be specified.
- accesstokentype accesstokentype-str
- Specifies the type of access token. Must be a token type supported by the server. The ACCESSTOKENTYPE is mandatory when using TOKEN authentication, but is optional for GSSPLUGIN.
- APIKEY apikey-str
- Identifies the API key used for authentication at the server. An APIKEY can only be specified when the negotiated authentication type for the connection is GSSPLUGIN (SQLSTATE 08001). user
- Specifies the user ID to connect to the database. password
- Specifies the password that corresponds to the user ID. hostname
- Specifies the name of the computer on which the database is located. For example, for a computer that is named ascender, specify @ascender. variable
- 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. login.sql is
read from following locations:
- Loc-1: login.sql is configurable using environment variable CLPPLUS_USER_STARTUP_SCRIPT. For example, define in an environment variable as <CLPPLUS_USER_STARTUP_SCRIPT=C:\conf\login.sql>
- Loc-2: Configure login.sql in the home directory of a client machine to launch directory.
- Loc-3: Configure login.sql in the current directory. Clpplus is launched from the current directory.
If login.sql is configured using all three locations in the client machine then Loc-1 is of highest precedence to apply in clpplus. Order of precedence from highest to lowest for applying in clpplus is Loc-1>Loc-2>Loc-3.
port
- Specifies the port number that receives connections on the computer where the database server is installed. The default is 50000. database
- 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. dsn_alias
- 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 interactively. If you
configure an LDAP directory server in the specified IBM data
server driver configuration file, the following steps apply:
- 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.
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.
clientApplompat
- For connections to Db2 for z/OS 12.0 with data servers at a function level of V12R1M501 or later, set the capabilities of a particular instance of the IBM Data Server Driver for JDBC and SQLJ to a function level that is less than or equal to the function level of the data server. This is optional when using (). currentPackageSet
- The currentPackageSet identifies the collection ID to search for necessary packages when executing test cases using clpplus. This is optional when using (). Authentication
- This parameter is used to specify the authentication type the user wants when connecting using clpplus session. This is optional when using (). securityTransportMode
- This parameter is used to specify value "SSL". This will set the SSL connection to true when the user wants to use SSL when connecting using clpplus session. This is optional when using (). sslCertLocation
- This parameter is used to specify certificate location when the user wants to use SSL when connecting using surplus session. This is optional when using (). securityTransportMode and sslCertLocation need to specify together in order to connect using SSL connection.
Examples
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 1.1.0.10 (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 1.1.0.10 (localhost:5444/db2) AS CLPPlus
SQL> CONNECT /
SQL> CONNECT db2admin@data_dsn
define connStr =
localhost:50000/sample
and can be used in the CONNECT CLPPlus command as
follows:SQL> CONNECT db2admin@connStr
A connection by the db2admin user is
attempted on the sample database on the localhost, which has a listener port number of 50000.