Command line processor CONNECT command
The DB2® command line processor CONNECT command establishes a connection to a DB2 server.
>>-CONNECT--TO--+-| connection-url |--USER--user-id--USING--password-+->< '-connection-alias-----------------------------------' connection-url |--server--+-------+--/database---------------------------------> '-:port-' >--+-----------------------------+------------------------------| '-:-| connection-properties |-' connection-properties .---------------------. V | |----+-----------------+-+--------------------------------------| '-property=value;-'
- TO connection-url
- Specifies the DB2 database system to which the connection is made. It consists of the following parts:
- server
- The domain name or IP address of the DB2 database system.
- port
- The TCP/IP server port number that is assigned to the DB2 database system. This is an integer between 0 and 65535. The default is 446.
- database
- A name for the DB2 database system. database is the DB2 location name that is defined during installation. All characters
in the DB2 location name must be uppercase
characters. You can determine the location name by executing the following SQL statement on the DB2 database system to which you want to connect:
SELECT CURRENT SERVER FROM SYSIBM.SYSDUMMY1;
- connection-properties
- A list of IBM® Data Server Driver for JDBC and
SQLJ properties
and their values. You can specify one or more property and value pairs. Each property and
value pair, including the last one, must end with a semicolon (;). Do not include spaces or
other white space characters anywhere within the list of property and value
strings.
Specify connection properties only if your system administrator tells you to do so.
- USER user-id
- The authorization name to use when connecting to the DB2 server.
This name is case insensitive. However, if you run the LIST TABLES command to see your own tables, the case of user-id must match the case of the schema name for your tables. For example, if you connect to the DB2 database server with a user ID of myid, LIST TABLES does not list tables with a schema name of MYID.
- USING password
- The password for the authorization name that is used when connecting to the DB2 server.
- connection-alias
- A name that corresponds to an entry in the properties file that is defined by the CLPPROPERTIESFILE environment variable. That entry specifies the connection URL, user ID, and password for the connection.
- Example: Making a connection for the command line processor by specifying a connection URL, ID and password
- Suppose that your system administrator told you that the DB2 server against which you want to use the command line processor has the connection URL syszos1.abc.com:5021/ABCLOC1. Your ID is myid01 and your password is mypw01. Use this command to make a connection to that server:
CONNECT TO syszos1.abc.com:5021/ABCLOC1 USER myid01 USING mypw01
- Example: Making a connection for the command line processor by specifying a connection alias
- Suppose that the CLPPROPERTIESFILE environment variable specifies a file named
clp.properties. In that file, the following connection alias is
defined:
Use this command to make a connection using the connection alias:MYALIAS01=syszos1.abc.com:5021/ABCLOC1,myid01,mypw01
CONNECT TO MYALIAS01