Building and Running Applications
Total Page:16
File Type:pdf, Size:1020Kb
® ™ IBM DB2 Universal Database Application Development Guide: Building and Running Applications Ve r s i o n 8.2 SC09-4825-01 ® ™ IBM DB2 Universal Database Application Development Guide: Building and Running Applications Ve r s i o n 8.2 SC09-4825-01 Before using this information and the product it supports, be sure to read the general information under Notices. This document contains proprietary information of IBM. It is provided under a license agreement and is protected by copyright law. The information contained in this publication does not include any product warranties, and any statements provided in this manual should not be interpreted as such. You can order IBM publications online or through your local IBM representative. v To order publications online, go to the IBM Publications Center at www.ibm.com/shop/publications/order v To find your local IBM representative, go to the IBM Directory of Worldwide Contacts at www.ibm.com/planetwide To order DB2 publications from DB2 Marketing and Sales in the United States or Canada, call 1-800-IBM-4YOU (426-4968). When you send information to IBM, you grant IBM a nonexclusive right to use or distribute the information in any way it believes appropriate without incurring any obligation to you. © Copyright International Business Machines Corporation 1993 - 2004. All rights reserved. US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. Contents | Welcome to DB2 application Where to go next . .58 || development . vii || DB2 Developer’s Edition Products. vii Chapter 3. Sample programs and || About this book . viii related files. .59 Sample files . .59 Part 1. The Application Development Sample programs by language and application interface . .64 Environment . .1 C samples . .64 C++ samples . .67 Chapter 1. DB2 environment support . .3 | C# samples . .70 DB2 Application Development Client . .3 CLI samples . .71 Database manager instances . .5 Command Line Processor (CLP) samples . .73 DB2 supported servers . .7 COBOL samples . .73 DB2 supported development software . .7 | Dynamic reconfiguration samples . .77 AIX supported development software . .8 JDBC samples . .78 HP-UX supported development software . .10 SQLJ samples. .80 Linux supported development software . .12 Java WebSphere samples . .82 Solaris supported development software. .17 Java plug-in samples . .83 Windows supported development software. .19 Log management user exit samples . .83 Object Linking and Embedding (OLE) samples 85 Chapter 2. Setup . .23 Object Linking and Embedding Database (OLE General setup information . .23 DB) table function samples . .86 Setting up the application development | Perl Samples . .86 environment . .23 | PHP samples . .87 || Rebuilding DB2 routine shared libraries . .25 REXX samples . .88 Updating the database manager configuration file 25 | Security plug-in samples . .90 Setting up the Java environment . .26 SQL procedure samples . .90 || Setting up DB2 WebSphere MQ functions . .28 Visual Basic samples . .93 UNIX . .31 | Visual Basic .NET samples . .94 Setting up the UNIX application development Visual C++ samples . .96 environment . .31 Windows Management Instrumentation samples 96 UNIX environment variable settings . .32 Build files, makefiles, and error-checking utilities . .97 Setting up the UNIX Java environment . .32 Build files . .97 Setting up the AIX Java environment . .34 Makefiles . .99 Setting up the HP-UX Java environment. .35 Error-checking utilities . 102 Setting up the Linux Java environment . .37 Setting up the Solaris Java environment . .38 Part 2. Building and Running Windows . .38 Platform-Independent Applications 105 Setting up the Windows application development environment . .39 Setting up the Windows Java environment . .42 Chapter 4. Java . 107 Sample database. .44 Java sample programs . 107 Setting up the sample database . .44 Java applet considerations . 108 Creating the sample database . .45 JDBC . .110 Creating the sample database on Host or AS/400 Building JDBC applets . .110 and iSeries servers . .46 Building JDBC applications . 111 Cataloging the sample database . .47 Building JDBC routines . .112 Binding the sample database utilities . .47 SQLJ . .114 Migrating applications. .49 Building SQLJ programs. .114 Migrating applications to DB2 Version 8 . .49 Building SQLJ applets . .115 Migrating Java applications, routines, and applets 50 Building SQLJ applications . .117 Migrating applications from 32-bit to 64-bit UNIX build script for SQLJ applications and environments . .51 applets . .118 Ensuring application portability . .54 SQLJ application and applet options for UNIX 119 Running applications on two versions of DB2 . .55 © Copyright IBM Corp. 1993 - 2004 iii Windows batch file for SQLJ applications and AIX C++ application compile and link options 173 applets . .119 | Build script for C++ routines . 174 SQLJ application and applet options for AIX C++ routine compile and link options . 174 Windows . 121 Building C++ multi-threaded applications on Building SQLJ routines . 121 AIX . 175 UNIX build script for SQLJ routines . 123 VisualAge C++ configuration files . 176 SQLJ routine options for UNIX . 124 Building VisualAge C++ programs with Windows batch file for SQLJ routines . 125 configuration files . 176 SQLJ routine options for Windows . 126 Building C++ DB2 API applications with configuration files . 177 | Chapter 5. The Command Line Building C++ embedded SQL applications with || Processor . 129 configuration files . 178 Building C++ stored procedures with || Running Command Line Processor (CLP) scripts 129 configuration files . 178 Calling procedures from the Command Line Building C++ user-defined functions with Processor (CLP) . 130 configuration files . 180 IBM COBOL Set for AIX. 181 Chapter 6. SQL procedures . 133 Configuring the IBM COBOL compiler on AIX 181 Creating SQL procedures . 133 Building IBM COBOL applications on AIX . 182 Calling SQL procedures with client applications 134 Build script for IBM COBOL applications . 183 Customizing precompile and bind options for SQL AIX IBM COBOL application compile and link procedures . 135 options . 183 Backing up and restoring SQL procedures created Building IBM COBOL routines on AIX . 184 prior to DB2 8.2 . 136 Build script for IBM COBOL routines . 186 Rebinding SQL procedures . 137 AIX IBM COBOL routine compile and link options . 186 || Chapter 7. Perl . 139 Micro Focus COBOL . 187 || Building Perl applications . 139 Configuring the Micro Focus COBOL compiler on AIX . 187 || Chapter 8. PHP. 141 Build script for Micro Focus COBOL || Building PHP applications . 141 applications . 188 AIX Micro Focus COBOL application compile and link options . 188 Part 3. Building and Running Build script for Micro Focus COBOL routines 189 Platform-Specific Applications . 145 AIX Micro Focus COBOL routine compile and link options . 190 || Chapter 9. UNIX . 147 REXX . 191 || Building UNIX C applications . 147 Building REXX applications on AIX . 191 || Building UNIX C multi-connection applications 149 || Building UNIX C routines . 151 Chapter 11. HP-UX . 193 || Building UNIX C++ applications . 154 HP-UX C . 193 || Building UNIX C++ multi-connection applications 155 | Build script for C applications . 193 || Building UNIX C++ routines . 158 HP-UX C application compile and link options 194 || Building UNIX Micro Focus COBOL applications 161 | Build script for C routines . 195 || Building UNIX Micro Focus COBOL routines. 162 HP-UX C routine compile and link options . 196 Building C multi-threaded applications on Chapter 10. AIX . 165 HP-UX . 197 Important considerations . 165 HP-UX C++ . 198 AIX export files for routines . 165 | Build script for C++ applications . 198 AIX routines and the CREATE Statement . 166 HP-UX C++ application compile and link Replacing an AIX shared library . 167 options . 199 Considerations for installing COBOL on AIX 167 | Build script for C++ routines . 201 IBM C . 167 HP-UX C++ routine compile and link options 201 || Build script for C applications . 168 Building C++ multi-threaded applications on AIX C application compile and link options . 168 HP-UX . 203 || Build script for C routines . 169 Micro Focus COBOL . 203 AIX C routine compile and link options . 170 Configuring the Micro Focus COBOL compiler Building C multi-threaded applications on AIX 171 on HP-UX . 203 VisualAge C++ . 172 Build script for Micro Focus COBOL || Build script for C++ applications . 172 applications . 204 iv Building and Running Applications HP-UX Micro Focus COBOL application Object Linking and Embedding Database (OLE DB) compile and link options . 204 table functions . 236 Build script for Micro Focus COBOL routines 205 Windows Management Instrumentation (WMI) . 237 HP-UX Micro Focus COBOL routine compile Microsoft Visual Basic . 237 and link options . 206 Building ADO applications with Visual Basic 237 | Building loosely-coupled transactions with Chapter 12. Linux . 207 | Visual Basic . 240 Linux C . 207 | Troubleshooting a Visual Basic loosely-coupled || Build script for C applications . 207 | transaction project . 242 Linux C application compile and link options 208 Building RDO applications with Visual Basic 243 || Build script for C routines . 209 Object Linking and Embedding (OLE) Linux C routine compile and link options . 210 automation with Visual Basic . 244 Building C multi-threaded applications on Linux 211 .NET . 245 Linux C++ . 212 | Building C# .NET applications. 245 || Build script for C++ applications . 212 Batch file for