Installing "Minimal" DB2 Run Time Client and Application Development Client Linux, Beta ================================================================== Contents 1 About this document 1.1 Who should read this document 1.2 Download the zip file 2 Contents of zip file (db2_clients_linux.zip) 3 Pre-installation procedures 4 Installation procedures 5 Post-installation procedures 6 Troubleshooting procedures --------------------------------------------------------------- 1 About this document This document contains the instructions to install the "minimal" version of the DB2 Run Time Client and the DB2 Application Development Client, beta, on the Linux platform. 1.1 Who should read this document This document is intended for users of IBM Cloudscape who require ODBC Support and need only minimal functionality from the DB2 Run Time Client and the DB2 Application Development Client. 1.2 Download the zip file Download the DB2 Run Time Client as follows: - Go to https://www6.software.ibm.com/dl/cloudscape/cloudscape-i?S_PKG=db2rtlin_ww - Register yourself if you have not registered yet. - Sign in with the userid and the password that you have registered with. - On the next page, answer all the questions and click on "View License". - After viewing the license, click on "Accept License". - Download the file "db2_clients_linux.zip" --------------------------------------------------------------- 2 Contents of zip file (db2_clients_linux.zip) readme_linux.txt - This file db2_install - program to install RPM packages db2_deinstall - program to uninstall RPM packages IBM_db2msen81-8.1.0-64.i386.rpm - RPM package IBM_db2cliv81-8.1.0-64.i386.rpm - RPM package IBM_db2cucs81-8.1.0-64.i386.rpm - RPM package IBM_db2conv81-8.1.0-64.i386.rpm - RPM package IBM_db2sp81-8.1.0-64.i386.rpm - RPM package IBM_db2adt81-8.1.0-64.i386.rpm - RPM package IBM_db2adsg81-8.1.0-64.i386.rpm - RPM package IBM_db2jdbc81-8.1.0-64.i386.rpm - RPM package --------------------------------------------------------------- 3 Pre-installation procedures (1) If you have any DB2 client or server products installed on your machine from any other source, uninstall it by following the instructions provided by that source. (2) If you have the "minimal" version of the DB2 Run Time Client and the DB2 Application Development Client already installed on your machine, do the following: - Login as a user with root authority. - Go to the directory where you have unzipped the contents of the db2_clients_linux.zip file. - Run the db2_deinstall script as follows: >./db2_deinstall --------------------------------------------------------------- 4 Installation procedures Do the following to install the "minimal" version of DB2 Run Time Client and the DB2 Application Development Client: (1) Login as a user with root authority. (2) Go to the directory where you have unzipped the contents of the db2_clients_linux.zip file. (3) Run the db2_install script as follows: >./db2_install (4) The db2_install script installs the "minimal" clients (DB2 Run Time Client and Application Development Client) in the directory "/opt/IBM/db2/V8.1". You may not install the DB2 clients in any directory other than the default. You may use a symbolic link to create a link to the default directory from any other directory. This directory will be referred as ${db281} in the rest of this document. --------------------------------------------------------------- 5 Post-installation procedures Post-installation procedures are steps to ensure that the DB2 Clients (Run Time and Application Development) can connect to the Cloudscape Server. Note: ---- You need to have IBM Cloudscape installed on your machine to do the post-installation procedures. The directory in which you have installed IBM Cloudscape will be referred to as the ${cloudscape} directory in the rest of this document. Do the following to check if the DB2 Clients (Run Time and Application Development) can communicate with the Cloudscape Server: (1) Login as a user with root authority. (2) Create a DB2 instance. A DB2 instance is an environment to store data and run applications. Use the db2icrt command to create an instance as follows: - Go to directory ${db281}/instance - Run the db2icrt command as follows: >./db2icrt -a SERVER -s client InstName where InstName is the login name of the instance, and there must be a user with this name prior to running the above command. Example ------- >./db2icrt -a SERVER -s client db2inst1 The above command will create a directory "sqllib" in home directory of user db2inst1. (3) Switch to the user for which you have created the DB2 Instance. Run the command as follows: >su -l db2inst1 (4) Run the command db2. The db2 command starts the command line processor (CLP). The CLP is used to execute database utilities, SQL statements and online help. Run the command as follows: >db2 (5) Now open another terminal window, and start the Cloudscape Network Server as follows: - Go to the directory where you have installed Cloudscape. >cd ${cloudscape} - Setup the CLASSPATH to point to the following Cloudscape jar files in directory ${cloudscape}/lib: derby.jar derbynet.jar derbytools.jar - Setup the PATH to point to whichever jdk you are using. - Start the Network Server by issuing the following command: >java org.apache.derby.drda.NetworkServerControl start (6) Open another terminal window, and start Cloudscape command line processor as follows: - Go to the directory where you have installed Cloudscape. >cd ${cloudscape} - Setup the CLASSPATH to point to the following Cloudscape jar files in directory ${cloudscape}/lib: derby.jar derbytools.jar db2jcc.jar db2jcc_license_c.jar - Setup the PATH to point to whichever jdk you are using. - Run the following command to start Cloudscape command line processor: >java org.apache.derby.tools.ij - Now you will get the prompt "ij>". Give the following command at the prompt "ij>": ij>connect 'jdbc:derby:net://localhost:1527/DataBaseName;create=true:user=usr;password=pwd;'; where DataBaseName is the name of the database to be choosen by the user. The Database name should be given in upper case. Example: -------- The following command creates a database with the name "MY_TEST_DB": ij>connect 'jdbc:derby:net://localhost:1527/MY_TEST_DB;create=true:user=usr;password=pwd;'; (7) Now go back to the window in which you ran the db2 command(see step 4). At the prompt "db2 =>", issue the following commands to check if the DB2 Clients (Run Time and Application Development) can communicate with the Cloudscape Server: Note: The following commands uses database name "my_test_db", and node name "cns". If you are using any other names for database and node, the commands should be changed accordingly. db2 => catalog tcpip node cns remote localhost server 1527 DB20000I The CATALOG TCPIP NODE command completed successfully. DB21056W Directory changes may not be effective until the directory cache is refreshed. db2 => catalog db my_test_db at node cns authentication server DB20000I The CATALOG DATABASE command completed successfully. DB21056W Directory changes may not be effective until the directory cache is refreshed. db2 => connect to my_test_db user usr using pwd Database Connection Information Database server = Apache Derby CSS10000 SQL authorization ID = USR Local database alias = MY_TEST_DB Note: ----- On some versions of Linux, the above command will give the error similar to the following: SQL30081N A communication error has been detected. Communication protocol being used: "TCP/IP". Communication API being used: "SOCKETS". Location where the error was detected: "127.0.0.1". Communication function detecting the error: "connect". Protocol specific error code(s): "111", "*", "*". SQLSTATE=08001 In that case, follow instructions given in section 6 "Troubleshooting procedures" of this document before proceeding further. db2 => select * from sys.systables TABLEID TABLENAME TABLETYPE SCHEMAID LOCKGRANULARITY ------------------------------------ ---------------- --------- ------------------------------------ ------------------- 80000010-00d0-fd77-3ed8-000a0a0b1900 SYSCONGLOMERATES S 8000000d-00d0-fd77-3ed8-000a0a0b1900 R 80000018-00d0-fd77-3ed8-000a0a0b1900 SYSTABLES S 8000000d-00d0-fd77-3ed8-000a0a0b1900 R 8000001e-00d0-fd77-3ed8-000a0a0b1900 SYSCOLUMNS S 8000000d-00d0-fd77-3ed8-000a0a0b1900 R 80000022-00d0-fd77-3ed8-000a0a0b1900 SYSSCHEMAS S 8000000d-00d0-fd77-3ed8-000a0a0b1900 R 8000002f-00d0-fd77-3ed8-000a0a0b1900 SYSCONSTRAINTS S 8000000d-00d0-fd77-3ed8-000a0a0b1900 R 80000039-00d0-fd77-3ed8-000a0a0b1900 SYSKEYS S 8000000d-00d0-fd77-3ed8-000a0a0b1900 R 8000003e-00d0-fd77-3ed8-000a0a0b1900 SYSDEPENDS S 8000000d-00d0-fd77-3ed8-000a0a0b1900 R c013800d-00d7-ddbd-08ce-000a0a411400 SYSALIASES S 8000000d-00d0-fd77-3ed8-000a0a0b1900 R 8000004d-00d0-fd77-3ed8-000a0a0b1900 SYSVIEWS S 8000000d-00d0-fd77-3ed8-000a0a0b1900 R 80000056-00d0-fd77-3ed8-000a0a0b1900 SYSCHECKS S 8000000d-00d0-fd77-3ed8-000a0a0b1900 R 8000005b-00d0-fd77-3ed8-000a0a0b1900 SYSFOREIGNKEYS S 8000000d-00d0-fd77-3ed8-000a0a0b1900 R 80000000-00d1-15f7-ab70-000a0a0b1500 SYSSTATEMENTS S 8000000d-00d0-fd77-3ed8-000a0a0b1900 R 80000000-00d3-e222-873f-000a0a0b1900 SYSFILES S 8000000d-00d0-fd77-3ed8-000a0a0b1900 R c013800d-00d7-c025-4809-000a0a411200 SYSTRIGGERS S 8000000d-00d0-fd77-3ed8-000a0a0b1900 R f81e0010-00e3-6612-5a96-009e3a3b5e00 SYSSTATISTICS S 8000000d-00d0-fd77-3ed8-000a0a0b1900 R c013800d-00f8-5b70-bea3-00000019ed88 SYSDUMMY1 S c013800d-00f8-5b53-28a9-00000019ed88 R 16 record(s) selected. db2 => disconnect my_test_db DB20000I The SQL DISCONNECT command completed successfully. db2 => uncatalog db my_test_db DB20000I The UNCATALOG DATABASE command completed successfully. DB21056W Directory changes may not be effective until the directory cache is refreshed. db2 => uncatalog node cns DB20000I The UNCATALOG NODE command completed successfully. DB21056W Directory changes may not be effective until the directory cache is refreshed. (8) Go back to the window with the prompt "ij>" (see step 5) and issue the following commands: ij>disconnect; ij>exit; (9) Go back to the window in which you started the Cloudscape Network Server (check step 6) and issue one of the following command to shut down the Network Server >java org.apache.derby.drda.NetworkServerControl shutdown OR >java org.apache.derby.drda.NetworkServerControl shutdown -h Use this command with the flag -h only if you started the Network Server by giving -h flag. --------------------------------------------------------------- 6 Troubleshooting procedures This section provides the instructions in case the db2 command "connect to DATABASENAME user usr using pwd" gave an error. The error occured because the localhost mapping does not work properly on your machine. In this case, do the folllowing: (1) Stop the Network Server that you started in step 5 of section 5 of this document as follows: >java org.apache.derby.drda.NetworkServerControl shutdown (2) Disconnect the database that you connected to from the prompt "ij>" in step 6 of section 5 of this document as follows: ij>disconnect; (3) Restart the Network Server as follows: >java org.apache.derby.drda.NetworkServerControl start -h Note that an additional flag (-h ) has been added to the command used to start the Network Server this time, where is an ip address of the machine. Example: -------- >java org.apache.derby.drda.NetworkServerControl start -h 9.12.345.678 (4) Reconnect to the database from the prompt "ij>" as follows: ij>connect 'jdbc:derby:net://IpAddress:1527/DataBaseName;create=true:user=usr;password=pwd;'; Note that "localhost" is been replaced with ip address of the machine. Example: -------- ij>connect 'jdbc:derby:net://9.12.345.678:1527/MY_TEST_DB;create=true:user=usr;password=pwd;'; (5) Go back to command prompt "db2 =>", and issue the following commands: db2 => uncatalog db my_test_db DB20000I The UNCATALOG DATABASE command completed successfully. DB21056W Directory changes may not be effective until the directory cache is refreshed. db2 => uncatalog node cns DB20000I The UNCATALOG NODE command completed successfully. DB21056W Directory changes may not be effective until the directory cache is refreshed. db2 => catalog tcpip node cns remote 9.12.345.678 server 1527 DB20000I The CATALOG TCPIP NODE command completed successfully. DB21056W Directory changes may not be effective until the directory cache is refreshed. Note that "localhost" is been replaced with an ip address "9.12.345.678" (6) Go back to step 7 of section 5, and start from command "db2 => connect to my_test_db user usr using pwd".