outsource from india chennai india programmers freelance php coder freelance outsource scripts programming complicated perl patterns php module installation
outsource from india perl installation and configuration php installation linux system administration US$15,US$19,US$11,US$10 cheap programmer
india outsource outsource india chennai india programmers php perl mysql freelance freelance programmer
SHOWCASE of php and perl scripts CONTACT US for php custom perl scripts
HOME
 

8. Using DB2

This section gives you the basic information you need to start working with DB2 on Linux. It includes instructions on issuing DB2 commands and SQL statements from the command line, as well as the commands you need to start the DB2 Control Center and the DB2 Information Center.

Note

This section assumes that you have followed the instructions in Section 11.

8.3. The DB2 command line

If you are logged on to your Linux workstation using either the DB2 Administration Server user ID or the DB2 instance user ID, you can issue DB2 commands and SQL statements from the command line.

If this is your first time using DB2, I would suggest creating the sample database that ships with DB2. The sample database is used throughout the DB2 documentation and is required by most of the sample applications. To create the sample database, you can either select the Create the sample database option when you create a DB2 instance, or issue the db2sampl command from the DB2 command line.

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"

Note

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:

You can issue database manager commands and SQL statements from the command
prompt. For example:
    db2 => connect to sample
    db2 => bind sample.bnd

For general help, type: ?.
For command help, type: ? command, where command can be
the first few keywords of a database manager command. For example:
 ? CATALOG DATABASE for help on the CATALOG DATABASE command
 ? CATALOG          for help on all of the CATALOG commands.

To exit db2 interactive mode, type QUIT at the command prompt. Outside
interactive mode, all commands must be prefixed with 'db2'.
To list the current command option settings, type LIST COMMAND OPTIONS.

For more detailed help, refer to the Online Reference Manual.

db2 =>

I don't use the CLP because it prevents me from using the command line history feature of my shell. I find myself using the command line history a lot when I'm issuing SQL statements.

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.


Linux HOWTO full list
   This document, LDP HOWTO-INDEX, is copyrighted (c) 1995 - 2002 by Tim Bynum, Guylhem Aznar, Joshua Drake and Greg Ferguson. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is available at http://www.gnu.org/copyleft/fdl.html. If you have questions, please contact the LDP.
Web Design Copyright © 1999-2003. Chrisranjana Software Solutions Pvt Ltd. syndicate rss feed