To use the examples in this book, you need to install the SAMPLE database on a server workstation. Refer to the SQL Reference for a listing of the contents of the SAMPLE database.
If you will be accessing the SAMPLE database on the server from a remote client, you need to catalog the SAMPLE database on the client workstation.
Also, if you will be accessing the SAMPLE database on the server from a remote client that is running a different version of DB2 or running on a different operating system, you need to bind the database utilities, including the DB2 CLI, to the SAMPLE database.
To create the SAMPLE database, you must have Administrator authority. If you need more information about Administrator authority, refer to the Quick Beginnings book.
To install the database, do the following on the server:
$HOME/sqllib/misc
where $HOME is the home directory of the DB2 instance owner.
%DB2PATH% \bin
where %DB2PATH% is where DB2 is installed.
DB2INSTANCE=instance_name export DB2INSTANCE
where instance_name is the name of the database instance.
set DB2instance=instance_name
db2sampl path
On OS/2 or Windows-based systems, this is a drive, and would be entered as:
db2sampl drive
If you do not specify the path or drive, the installation program installs the sample tables in the default path or drive specified by the DFTDBPATH parameter in the database manager configuration file. If you need information about the configuration file, refer to the Administration Guide.
The authentication type for the database is the same as the instance in which it is created. If you need more information about specifying authentication when creating a database instance, refer to the Quick Beginnings book.
Installing on DRDA-Compliant Application Servers
If you want to run the sample programs against a DRDA-compliant application server, such as DB2 for MVS/ESA, you need to create a database that contains the sample STAFF and ORG tables described in the SQL Reference. You may want to refer to the sample program, expsamp, which uses the STAFF and ORG tables to demonstrate how APIs are used to import and export tables and table data to and from a DRDA database.
To create the database:
If you need information about exporting and importing files, refer to the Command Reference and the API Reference. If you need information about connecting to a database and creating tables, refer to the SQL Reference.
If you will be accessing the SAMPLE database on the server from a remote client, you need to catalog the SAMPLE database on the client workstation.
You do not need to catalog the SAMPLE database on the server workstation because it was cataloged when you created it.
Cataloging updates the database directory on the client workstation with the name of the database that the client application wants to access. When processing client requests, the database manager uses the cataloged name to find and connect to the database.
The Quick Beginnings book provides general information on cataloging databases. This section provides specific instructions on cataloging the SAMPLE database.
To catalog the sample database from the remote client workstation, enter:
db2 catalog database sample as sample at node nodename
where nodename is the name of the server node.
The Quick Beginnings book explains how to catalog nodes as part of setting up communication protocols. You must also catalog the remote node before you can connect to the database.
If you will be accessing the SAMPLE database on the server from a remote client that is running a different version of DB2 or running on a different operating system, you need to bind the database utilities, including the DB2 CLI, to the SAMPLE database.
To bind the database utilites, do the following on the client workstation:
db2 connect to sample
db2 bind BNDPATH/@db2ubind.lst blocking all sqlerror continue messages bind.msg
db2 bind BNDPATH/@db2cli.lst blocking all sqlerror continue messages cli.msg
where BNDPATH is the path where the bind files are located, such as $HOME/sqllib/bnd/, where $HOME is the home directory of the DB2 instance owner.
Note: | If you installed the SAMPLE database on a DRDA-compliant application server,
specify one of the following .lst files instead of
db2ubind.lst :
|
The Quick Beginnings book provides general information about binding the database utilities.