You need to connect to the database before you can use SQL statements to query or update it. The CONNECT statement associates a database connection with a user ID.
A database is created in an instance using one of three different authentication types: CLIENT, SERVER, or DCS. If an authentication type is not specified when the instance is created, the default SERVER authentication is used. You connect to a database differently depending on the authentication type and where the database resides.
connect to sample
connect to sample user userid using password
(Be sure to choose values for userid and password that are valid on the server system.)
connect to sample
![]() |
If you are connecting to the database from an OS/2 system, and are not currently logged on, you will be prompted to log on using a user ID and password. If you are connecting to a database, from a Windows NT client using CLIENT authentication and you are providing a user ID and password on the CONNECT command, you must start the DB2 for Windows NT Security Service on the system. The Security Service is installed by DB2 and set up as a Windows NT service; however, it is not started automatically. To start the DB2 Security Service, double-click on the Services
icon in the Control Panel folder. Select the DB2
Security Server option and click on the Start push
button.
|
When a successful connection is made, a message similar to the following is displayed:
Database product = DB2/NT 5.0.0 SQL authorization ID = USERID Local database alias = SAMPLE
If you receive an error message, make sure that the SAMPLE database exists on the server and the database manager was started on the server.
For more information on authentication, refer to the Administration Guide .