![]() | This section assumes that you have followed the instructions in Section 11. |
Before you can issue an SQL statement, you have to connect to a database. To connect to a database:
To connect to a database, and have DB2 prompt you for the password:
db2 CONNECT TO database USER userID
To connect to a database using the default user ID:
db2 CONNECT TO database
Once you have connected to a database, you can then issue SQL statements or DB2 commands against that database. For example, to select all of the columns from the EMPLOYEE table in the SAMPLE database, issue the following command:
bash$ db2 "SELECT * FROM employee" |
![]() | You can avoid typing db2 as the prefix for every SQL statement and DB2 command by issuing commands using the Command Line Processor (CLP). To start the CLP, issue the db2 command by itself. DB2 provides the following prompt:
Some users claim that running the CLP within an Emacs shell gives them the best of both worlds: they get command line history, and they don't have to escape commands that contain lots of quotation marks and brackets. |
Закладки на сайте Проследить за страницей |
Created 1996-2025 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |