content:
Introduction Generate Response Files For Unattended Installation Use Response File Installation Precautions Create and Install Database Unload DB2 UDB Express Conclusion Other References Thanks to the author's evaluation
subscription:
DeveloperWorks Newsletter
Michael X. GaoDB2 UDB Consultant, IBM Canada 2003 June
DB2 UDB Express allows you to install DB2 in a way that is convenient, response file, which makes it easy to deploy DB2 UDB Express, and it also allows you to embed DB2 installation in your own application.
Introduction IBM® DB2® Universal DatabaseTM Express Edition (DB2 UDB Express) is the latest member of the IBM DB2 family. It is especially designed, priced and sold in the integration of small and medium-sized enterprises and management business processes. DB2 UDB Express provides:
Transparently installed with the app. Enhanced autonomous management features. Lower total cost of ownership. This article describes the full process of DB2 response file installation on the Microsoft® Windows® and Linux platforms (these platforms support DB2 UDB Express). Unlike standard DB2 installation utilities, DB2 response file installation does not require interactive user input to install DB2. This is useful for the installation of DB2's large-scale deployment and transparently embedding DB2 in your own installer. Response file installation is one of the reasons for DB2 to provide a complete solution for your embedded database requirements. The DB2 response file installation is an background installation process that can be embedded in an existing installer, which is transparent to the end user. The installation is performed by the DB2 installation utility with the user generated response file. The response file is an ASCII text file containing installation and configuration information, which can be generated with a DB2 utility or generated by manual editing. This article details the response file generation, response file installation, database installation, and uninstall, and special considerations to embed the DB2 installation process in your own application installer. Generating a response file response file installation process The first step is to generate a response file. When using an interactive installer to install DB2, you will be prompted to install and provide the necessary configuration data before installation. The response file contains only these installation options and configuration data, which have been ready for embedded use. You can use three methods to generate a response file:
Using DB2 Setup Wizard Using DB2 Response File Builder Utility (Windows only) Manually generates a response file response file is an ASCII text file. Listing 1 is a sample of partial response files. Listing 1. Site response file
PROD = udb_express_edition
Lic_agreement = accept
FILE = C: / SQLLIB /
INSTALL_TYPE = Custom
Comp = develop_center
...
Comp = Control_Center
Comp = Client_Tools
Comp = Command_Center
...
Comp = tcpip_db2_client_support
Comp = tcpip_db2_listener_support
LANG = EN
DAS_CONTACT_LIST = LOCAL
Instance = DB2
DB2.NAME = DB2
Default_instance = DB2
DB2.SVCENAME = DB2C_DB2
DB2.DB2COMM = TCPIP
DB2.Port_Number = 50000
Db2.Federated = YES
...
You can find a full sample response file below the DB2 installation CD:
For Linux, the sample response file is located at
Manually modify the file to accept the license agreement. Enter the user ID and password for the new system. Manually generate a response file Because the response file is an ASCII text file, you can create them manually. You can choose to modify the sample response file provided with the DB2 image, or you can recreate them yourself. This method needs to be thoroughly understood to understand the structure and keywords of the response file. Fortunately, the sample response file is very good, it is not necessary to explain more. The following is a short description of some of the keywords you specified in your response file. PROD specifies the product you want to install.
UDB_EXPRESS_EDITION (for DB2 UDB Express). Administration_client (for DB2 Management Client). Application_Development_client (for DB2 Application Development Client). Runtime_client (for DB2 runtime client). FILE Specifies the target directory of DB2 products (for Windows only). Install_type Specifies the installation type: Compact, Typical or Custom. CoMP Specifies the components you want to install. This keyword is ignored unless INSTALL_TYPE is Custom. LANG Specifies the language support you want to install. Reboot Specifies whether you want to restart the Windows system when the installation is complete. Kill_Processes Specifies whether to install without tips to terminate the currently running DB2 process (for Windows only). Other options also include options for the following: DB2 Management Server Settings instance Settings Database Settings For complete listings for keywords, detail and usage information, see Sample response files on the installation CD and DB2 UDB Express documents. Installation of unattended tube Use Response File This section describes:
Installation Process Generate Installation Log Tracking Installation The installation is very simple after you generate a response file. Use the same executable you use in the GUI installation. However, it is not only entering the command or double-click Setup.exe at the prompt, but you must provide the correct response file name. You can also specify additional options (such as path and name of the log file). Figure 4 is the syntax of the installation utility on Windows. For response file installation, only the response file name with the full path is forcibly. Figure 4. Syntax of the installation utility on the Windows platform
Setup [/ f] [/ i
[/ t
/? - generates this usage message
/ f - forces Any DB2 Processes to Stop Before Installing
/ I - Two letter code for the preferred language
/ L - Full Path and Name of the log file
/ u - Full Path and Name of the Response File
/ T - Creates a file with install TRACE INFORMATION
On Linux, use the DB2Setup syntax (shown in Figure 5). Figure 5. The syntax of DB2Setup on Linux is running in the background. There is no DB2 installation GUI. When the DB2 installation is embedded in your own installer, it is like a part of the installation process. After the installation is complete, the DB2 installation process returns a return code for your program. You can select a monitoring return code in your installer. Table 1 and Table 3 include the main return code of Windows and Linux. The main return code is the return code that is often received, and you should write code to handle them. There is also a secondary return code, they are not common. They are in Table 2 and Table 4. These four tables can also be found in the DB2 UDB Express document. Table 1. Main return code for responding to file installation on Windows
Return code description 0 is successfully completed. 1 Operation returns a warning. 1603 A fatal error occurred during the installation process. 3010 is installed successfully; but it needs to be rebooted to complete the installation. Table 2. The secondary return code return code description 3 of the response file installation on Windows is not found. 5 Reject to visit. 10 An environmental error occurred. 13 The data is invalid. 87 One of the parameters is invalid. 1602 Installation is canceled by the user. The 1610 configuration data is destroyed. Please contact your support staff. 1612 The installation source of this product is not available. Please verify that the installation source exists and you can access it. 1618 Another installation is already in progress. Before you continue this installation, complete another installation first. 1622 An error occurred while opening the installation log file. Verify that the location of the specified log file exists and that location is writable. The 1632TEMP folder is full or cannot be accessed. Please verify the TEMP folder exist and you can write to the folder. 1633 This installation package is not supported on this platform. 1638 Another version of this product has been installed. The installation of this version cannot continue. 1639 Invalid command line parameters. Table 3. Main return codes for responding to file installation on Linux
Return code description 0 is successfully completed. 1 Operation returns a warning. 67 Fatal errors occur during the installation process. Table 4. Secondary return code for responding to file installation on Linux
Return code description 3 did not find the path. 5 Reject to visit. 10 An environmental error occurred. 13 The data is invalid. 87 One of the parameters is invalid. 66 Installation is canceled by the user. 74 Table Data 76 The installation source of this product is not available. Please verify that the installation source exists and you can access it. 82 The other installation is already in progress. Before you continue this installation, complete another installation first. 86 An error occurred while opening the installation log file. Verify that the location of the specified log file exists and that location is writable. The 96TEMP folder is full or unable to access. Please verify the TEMP folder exist and you can write to the folder. 97 This installation package is not supported on this platform. 102 Another version of this product is installed. The installation of this version cannot continue. 103 Invalid command line parameters. The path and name to generate the installation log log file are optional parameters for the DB2 installer. If you do not specify the name and path of the log file, create a default log file in the default directory:
On Windows, the default file is db2.log, in the my documents / db2log directory used to perform DB2 installation. On Linux, the default file is /TMP/db2setup.log. In addition to these log files, other auxiliary log files and dumps or trace files are also created in the default directory.
On Windows, there is another log file from Windows Installer under the path you specify or in the default path mentioned above (named db2wi.log). During installation, the currently installed log item is recorded in the db2wi.log file. There is current and any previously installed information in the db2.log file. It is updated at the end of the DB2 installation. On Linux, you can also find other DB2 generated files in the / tmp directory. The db2setup.his log file retains the current and previously installed history. The DB2Setup.err log file contains all the error items. Tracking the path and name of the installation tracking file is also an optional parameter for the DB2 installer. The trace file contains the service information required for IBM support, and the tracking file is not provided to the user. You can safely remove them after successful installation. When you choose to create a trace file, the DB2 installation log file is generated in detail (ie, generate more detailed information in the log file). Installation Notes Whether you want to use the DB2 response file installation to deploy or embed in your application, you must ensure that the prerequisites are checked, ensuring that there is no DB2 process running and has a scheduled scheme. Checking the prerequisites Like the DB2 GUI installation, ensure that all prerequisites have been met in your own installation scripts before starting the DB2 response file installation process. Prerequisites include user privileges and system configurations. DB2 Installation Prerequisites have been well recorded in the DB2 UDB Express documentation and DB2 installation CD. Killing DB2 Processes When there are active DB2 processes, DB2 installation cannot be performed. You can only kill the DB2 process of the active DB2 process in Windows using the Kill_Processes keyword or / f option in the response file. However, killing DB2 processes will cause data loss. So we recommend using the db2stop command to each instance, we have described here. Before using the DB2Stop command, see the DB2 UDB Express documentation for full syntax. User program intervention is not possible to intervene in user program during the DB2 response file installation. After the installation process started, he was running. All things that your installer can do is to monitor the final return code. Failure installation When the installation fails, the DB2 installation process usually clears the newly installed component. Your own installer will resolve and check the log file or check the return code to identify the problem. If the problem can be remedy, you can try to reinstall DB2. Create and install the database after installing and configuring DB2 UDB Express, the next logic step is: Create a database. Create a database object, such as a table, view, trigger, function, and procedure. Fill in the table with data. However, these tasks beyond the scope discussed herein, for integrity considerations, we only make a brief discussion. How do you create and install your database primarily on the development language you use. You can use scripts or programs (written with C, JavaTM, and other variety of programming languages you selected) to install. You can even use the combination of scripts and programs to install. The simplest method of creating a database is to manually add the database part in the response file. The database will be created in the end of the installation. Figure 6 is a sample database portion of the MY_DB1 database under the DB2InSt1 instance. Figure 6. Sample Database section in the response file
Database = my_db
My_db.instance = db2inst1
MY_DB.DATABASE_NAME = MY_DB1
MY_DB.LOCATION = LOCAL
MY_DB.Alias = my_db1
MY_DB.USERNAME =
Username
MY_DB.Password =
Password
You can also create a database with a script or C DB2 API. If Java is the programming language you have selected, you must first create a database using one of the methods mentioned above. There is no Java management API definition in the JDBCTM standard. Once the database is created, you can create a database object and load the table. You can use multiple programming languages (such as C and ODBC / CLI or Java and JDBC) and its corresponding API to load data. If you have a lot of data to be loaded, consider using the DB2 Import or Load utility. See the DB2 UDB Express documentation about the syntax and usage of Import and LOAD. Uninstall DB2 UDB Express You can also embed DB2 UDB Express uninstall in your own uninstaller. The following is a step-by-step instructions for uninstalling DB2 UDB Express on Windows and Linux. Uninstall DB2 UDB Express on Windows On Windows System, you need to perform the following steps in the following order: Dossal all databases by entering the following command:
DB2 DROP DATABASE DATABASE-ALIAS
Disconnect all applications by entering the following command:
DB2 Force Application All
Stop all DB2 processes and services by entering the following command:
DB2STOP
DB2ADMIN STOP
Remove DB2 UDB Express products. To do this through the program, use Windows Installer. The command you want to use is:
Msiexec / x {58169F10-CA30-4F40-8C6D-C6DA8CE47E16}
For more information on the above command, please refer to the DB2 UDB Express documentation. Uninstall DB2 UDB Express on Linux On Linux system, you need to perform the following steps in the following order:
Doss all the databases by entering the following command: DB2 DROP DATABASE DATABASE-Alias. Stop the DB2 management server by logging in to the DB2 management server owner and issue a DB2Admin STOP command. Stop all DB2 instances by repeating each instance you created.
Log in as an example owner. Stop all database applications by entering the DB2 Force Application all command. Stop DB2 Database Manager by entering the DB2Stop command. Confirm that the instance is stopped by entering the DB2 Terminate command. Remove the management server:
Log in as root user. Send a command: /opt/ibm/db2/v8.1/ instance / dasdrop. Remove the following steps by repeating each instance you created:
Log in as root user. Send /Opt/ibm/db2/v8.1 / instance / db2idrop instanceName command. If you create the user ID and group of the instance owner during the installation process and they are used only by your program, remove them. Remove DB2 UDB Express. You have two options on Linux. For these two options, you must have super. you can:
Use the db2_deinstall command in the root directory of the DB2 UDB Express CD or image. Use the rpm command. For more information on the above DB2 command, please refer to the DB2 UDB Express documentation. For more information on the RPM command, visit the RPM Web site. Conclusion By using the DB2 response file installation, you can use DB2 UDB Express in your own installer. It does not require user input during installation, and it provides detailed, timely installation schedule information through the log file. Use the Response File Installation for performing large-scale DB2 UDB Express deployment, or embedding DB2 UDB Express in the application installation is good. Other Resources To view the response file installation how to run, see the DB2 UDB Express demo on http://www7b.software.ibm.com/dmdd/library/demos/db2express/. Acknowledgment author's deep gratitude to the help of IBM Toronto Lab's Andrew Hilden. About the author Michael GAO is the DB2 consultant of IBM Toronto Lab, IBM Toronto Lab develops DB2 of the distributed platform. He is currently in cooperation between application development, performance tuning, transplantation and customization training and IBM business partners. He attended some international conferences and with people with DB2 SQL Procedural Language for Windows, UNIX and Linux. You can contact michael through xmgao@ca.ibm.com and Michael.