You need to connect to a database before you can use SQL statements to query or manipulate it. The CONNECT statement associates a database connection with a user name.
For example, to connect to the SAMPLE database, type the following command in the DB2 command line processor :
CONNECT TO SAMPLE USER USERID USING PASSWORD
(Be sure to choose a user ID and password that are valid on the server system.)
In this example, USER is USERID and USING is PASSWORD.
The following message tells you that you have made a successful connection:
Database Connection Information Database product = DB2/NT 7.1.0 SQL authorization ID = USERID Local database alias = SAMPLE
Once you are connected, you can start manipulating the database. For further details on connections, refer to the CONNECT statement in the SQL Reference.