Developing PHP Applications for IBM Database Servers

Total Page:16

File Type:pdf, Size:1020Kb

Developing PHP Applications for IBM Database Servers Front cover Developing PHP Applications for IBM Data Servers Develop and deploy Web solutions using PHP and IBM data servers See PHP with DB2, Informix IDS, and Cloudscape examples Port PHP applications from MySQL to DB2 Whei-Jen Chen Holger Kirstein Daniel Krook Kiran H Nair Piotr Pietrzak ibm.com/redbooks International Technical Support Organization Developing PHP Applications for IBM Data Servers May 2006 SG24-7218-00 Note: Before using this information and the product it supports, read the information in “Notices” on page xi. First Edition (May 2006) This edition applies to DB2 UDB Version 8.2, Informix IDS Version 10, PHP Versions 4 and 5, Apache 1.3, and Apache 2. © Copyright International Business Machines Corporation 2006. All rights reserved. Note to U.S. Government Users Restricted Rights -- Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. Contents Figures . vii Tables . ix Notices . xi Trademarks . xii Preface . xiii The team that wrote this redbook. xiii Acknowledgement. xv Become a published author . xvi Comments welcome. xvi Chapter 1. Technology overview . 1 1.1 Web application environment . 2 1.1.1 Web application advantages . 2 1.1.2 Web application challenges . 3 1.1.3 The state of the Web application world . 4 1.1.4 Web application components . 4 1.2 IBM data servers . 5 1.2.1 DB2 data server . 5 1.2.2 Informix database server family . 8 1.2.3 Cloudscape . 10 1.3 HTTP Servers . 11 1.3.1 Apache HTTP Server . 12 1.3.2 IBM HTTP Server . 15 1.3.3 Which Web server do I choose? . 17 1.4 PHP . 18 1.5 Database interfaces with PHP. 22 1.5.1 DB2 and Cloudscape . 22 1.5.2 Informix IDS database extensions . 24 1.6 Zend products . 27 Chapter 2. Sample scenario description. 31 2.1 Application requirements. 33 2.1.1 Customer interface functional requirements . 35 2.1.2 Dealer interface functional requirements . 45 2.1.3 Non-functional requirements of the entire application. 52 2.2 Data model . 53 © Copyright IBM Corp. 2006. All rights reserved. iii 2.2.1 Tables . 54 2.3 Application design . 56 2.3.1 Controller components . 57 2.3.2 View pages . 59 2.3.3 Domain objects . 60 2.3.4 Database adapters . 67 2.3.5 Conclusion . 71 2.4 Application installation. 72 Chapter 3. Zend installation and configuration . 75 3.1 Zend Core for IBM. 76 3.1.1 Installation: Linux . 76 3.1.2 Installation: Windows . 79 3.1.3 Sample application . 81 3.2 Zend Studio . 83 3.2.1 Installation . 83 3.2.2 Configuration. 85 3.2.3 Debugger . 89 Chapter 4. PHP application development with DB2. 95 4.1 Application environment setup . 96 4.1.1 Lab environment description . 96 4.1.2 User IDs and group . 97 4.1.3 Database server installation and configuration . 98 4.1.4 Apache and PHP installation and configuration . 102 4.1.5 Environment verification . 110 4.2 Using PHP with DB2 database . 113 4.2.1 ibm_db2 . 113 4.2.2 PDO_IBM/PDO_ODBC. 139 4.2.3 Unified ODBC . 161 4.2.4 Porting PHP applications from Unified ODBC to ibm_db2 . 169 4.3 Troubleshooting DB2 - PHP applications . 170 4.3.1 Taking CLI trace . 170 4.3.2 db2diag.log . 174 4.3.3 Tools for monitoring, tuning, and troubleshooting . 175 4.3.4 Getting the best out of DB2 from PHP . 183 4.4 PHP application and DB2 for z/OS . 184 Chapter 5. PHP applications with Informix database servers. 187 5.1 Application environment setup . 188 5.1.1 Lab application environment . 189 5.1.2 Installing IBM Informix IDS V10.00 on Linux. 189 5.1.3 Installing the Apache Web server . 198 5.1.4 Installing the Informix client and connectivity . 202 iv Developing PHP Applications for IBM Data Servers 5.1.5 Setting up PHP with multiple Informix IDS interfaces . 203 5.1.6 Installation verification. 217 5.2 Application development with Informix IDS . 227 5.2.1 Connection to the database . 227 5.2.2 Static and dynamic SQL statements in PHP. 232 5.2.3 Cursor and result set. 247 5.2.4 Complex data types . 269 5.2.5 Working with stored procedures and user defined functions . 276 5.2.6 BLOB and SBLOB data types . 303 5.2.7 Error handling . 315 5.2.8 Transactions and isolation level . 325 5.2.9 PHP and Informix XPS SQL extensions . 333 5.3 Optimization . 341 5.4 Apache, PHP, and Informix IDS on Windows.
Recommended publications
  • Practical Perl Tools: Scratch the Webapp Itch With
    last tIme, we had the pleasure oF exploring the basics of a Web applica- DaviD n. BLank-EdeLman tion framework called CGI::Application (CGI::App). I appreciate this particular pack- age because it hits a certain sweet spot in practical Perl tools: terms of its complexity/learning curve and scratch the webapp itch with power. In this column we’ll finish up our exploration by looking at a few of the more CGI::Application, part 2 powerful extensions to the framework that David N. Blank-Edelman is the director of can really give it some oomph. technology at the Northeastern University College of Computer and Information Sci- ence and the author of the O’Reilly book Quick review Automating System Administration with Perl (the second edition of the Otter book), Let’s do a really quick review of how CGI::App available at purveyors of fine dead trees works, so that we can build on what we’ve learned everywhere. He has spent the past 24+ years as a system/network administrator in large so far. CGI::App is predicated on the notion of “run multi-platform environments, including modes.” When you are first starting out, it is easi- Brandeis University, Cambridge Technology est to map “run mode” to “Web page” in your head. Group, and the MIT Media Laboratory. He was the program chair of the LISA ’05 confer- You write a piece of code (i.e., a subroutine) that ence and one of the LISA ’06 Invited Talks will be responsible for producing the HTML for co-chairs.
    [Show full text]
  • Mysql Connector/ODBC Release Notes
    MySQL Connector/ODBC Release Notes Abstract This document contains release notes for the changes in each release of MySQL Connector/ODBC. For additional Connector/ODBC documentation, see MySQL Connector/ODBC Developer Guide. Updates to these notes occur as new product features are added, so that everybody can follow the development process. If a recent version is listed here that you cannot find on the download page (https://dev.mysql.com/ downloads/), the version has not yet been released. The documentation included in source and binary distributions may not be fully up to date with respect to release note entries because integration of the documentation occurs at release build time. For the most up-to-date release notes, please refer to the online documentation instead. For legal information, see the Legal Notices. For help with using MySQL, please visit the MySQL Forums, where you can discuss your issues with other MySQL users. Document generated on: 2021-09-23 (revision: 23350) Table of Contents Preface and Legal Notices ............................................................................................................ 3 Changes in MySQL Connector/ODBC Version 8.0 ......................................................................... 4 Changes in MySQL Connector/ODBC 8.0.26 (2021-07-20, General Availability) ....................... 4 Changes in MySQL Connector/ODBC 8.0.25 (2021-05-11, General Availability) ....................... 5 Changes in MySQL Connector/ODBC 8.0.24 (2021-04-20, General Availability) ....................... 5 Changes in MySQL Connector/ODBC 8.0.23 (2021-01-18, General Availability) ....................... 6 Changes in MySQL Connector/ODBC 8.0.22 (2020-10-19, General Availability) ....................... 7 Changes in MySQL Connector/ODBC 8.0.21 (2020-07-13, General Availability) ....................... 8 Changes in MySQL Connector/ODBC 8.0.20 (2020-04-27, General Availability) ......................
    [Show full text]
  • Guidelines for Tools Development and Operating Environments
    Managing social, behavioral and economic data and metadata Guidelines for Tools Development and Operating Environments Author/Maintainer Pascal Heus, Open Data Foundation Contributors Jack Gager(Metadata Technology), Jannick Jensen (Danish Data Archive), Herve Lhours (UKDA) Version 2010-08-03 Table of Contents Overview....................................................................................................................................................2 Product Development.................................................................................................................................3 Environment.......................................................................................................................................... 3 Collaborative environment.................................................................................................................... 4 Licensing............................................................................................................................................... 5 Products Guide...........................................................................................................................................8 Overview............................................................................................................................................... 8 Web server software.............................................................................................................................. 8 Rich client Platforms...........................................................................................................................10
    [Show full text]
  • Netezza EOL: IBM IAS Is a Flawed Upgrade Path Netezza EOL: IBM IAS Is a Flawed Upgrade Path
    Author: Marc Staimer WHITE PAPER Netezza EOL: What You’re Not Being Told About IBM IAS Is a Flawed Upgrade Path Database as a Service (DBaaS) WHITE PAPER • Netezza EOL: IBM IAS Is a Flawed Upgrade Path Netezza EOL: IBM IAS Is a Flawed Upgrade Path Executive Summary It is a common technology vendor fallacy to compare their systems with their competitors by focusing on the features, functions, and specifications they have, but the other guy doesn’t. Vendors ignore the opposite while touting hardware specs that mean little. It doesn’t matter if those features, functions, and specifications provide anything meaningfully empirical to the business applications that rely on the system. It only matters if it demonstrates an advantage on paper. This is called specsmanship. It’s similar to starting an argument with proof points. The specs, features, and functions are proof points that the system can solve specific operational problems. They are the “what” that solves the problem or problems. They mean nothing by themselves. Specsmanship is defined by Wikipedia as: “inappropriate use of specifications or measurement results to establish supposed superiority of one entity over another, generally when no such superiority exists.” It’s the frequent ineffective sales process utilized by IBM. A textbook example of this is IBM’s attempt to move their Netezza users to the IBM Integrated Analytics System (IIAS). IBM is compelling their users to move away from Netezza. In the fall of 2017, IBM announced to the Enzee community (Netezza users) that they can no longer purchase or upgrade PureData System for Analytics (the most recent IBM name for its Netezza appliances), and it will end-of-life all support next year.
    [Show full text]
  • SAP Database Administration with IBM
    André Faustmann, Michael Greulich, André Siegling, Benjamin Wegner, and Ronny Zimmerman SAP® Database Administration with IBM® DB2® Bonn Boston Contents at a Glance 1 Introduction ............................................................................ 19 2 SAP System Landscapes ......................................................... 25 3 Basics and Architecture of the IBM DB2 for LUW Database ................................................................................. 71 4 Lifecycle ................................................................................. 233 5 Administration Tools Inside and Outside the SAP System .... 327 6 Backup, Restore, and Recovery .............................................. 463 7 Monitoring DB2 SAP Systems with SAP Solution Manager .................................................................................. 575 8 SAP NetWeaver Business Warehouse and IBM DB2 for LUW .................................................................................. 647 9 Common Problems and Their Solutions for DB2 Administrators ........................................................................ 697 Contents Foreword .................................................................................... 15 Acknowledgments ....................................................................... 17 1 Introduction ................................................................. 19 1.1 Who This Book Is For .................................................... 21 1.2 Focus of This Book .......................................................
    [Show full text]
  • Version 7.8-Systemd
    Linux From Scratch Version 7.8-systemd Created by Gerard Beekmans Edited by Douglas R. Reno Linux From Scratch: Version 7.8-systemd by Created by Gerard Beekmans and Edited by Douglas R. Reno Copyright © 1999-2015 Gerard Beekmans Copyright © 1999-2015, Gerard Beekmans All rights reserved. This book is licensed under a Creative Commons License. Computer instructions may be extracted from the book under the MIT License. Linux® is a registered trademark of Linus Torvalds. Linux From Scratch - Version 7.8-systemd Table of Contents Preface .......................................................................................................................................................................... vii i. Foreword ............................................................................................................................................................. vii ii. Audience ............................................................................................................................................................ vii iii. LFS Target Architectures ................................................................................................................................ viii iv. LFS and Standards ............................................................................................................................................ ix v. Rationale for Packages in the Book .................................................................................................................... x vi. Prerequisites
    [Show full text]
  • Object Oriented Programming in Java Object Oriented
    Object Oriented Programming in Java Introduction Object Oriented Programming in Java Introduction to Computer Science II I Java is Object-Oriented I Not pure object oriented Christopher M. Bourke I Differs from other languages in how it achieves and implements OOP [email protected] functionality I OOP style programming requires practice Objects in Java Objects in Java Java is a class-based OOP language Definition Contrast with proto-type based OOP languages A class is a construct that is used as a blueprint to create instances of I Example: JavaScript itself. I No classes, only instances (of objects) I Constructed from nothing (ex-nihilo) I Objects are concepts; classes are Java’s realization of that concept I Inheritance through cloning of original prototype object I Classes are a definition of all objects of a specific type (instances) I Interface is build-able, mutable at runtime I Classes provide an explicit blueprint of its members and their visibility I Instances of a class must be explicitly created Objects in Java Objects in JavaI Paradigm: Singly-Rooted Hierarchy Object methods 1 //ignore: 2 protected Object clone(); 3 protected void finalize(); I All classes are subclasses of Object 4 Class<? extends Object> getClass(); 5 I Object is a java object, not an OOP object 6 //multithreaded applications: I Makes garbage collection easier 7 public void notify(); 8 public void notifyAll(); I All instances have a type and that type can be determined 9 public void wait(); I Provides a common, universal minimum interface for objects 10 public
    [Show full text]
  • IBM DB2 for Z/OS: the Database for Gaining a Competitive Advantage!
    Why You Should Read This Book Tom Ramey, Director, DB2 for z/OS IBM Silicon Valley Laboratory “This book is a ‘must read’ for Enterprise customers and contains a wealth of valuable information! “It is clear that there is a technology paradigm shift underway, and this is opening enormous opportunities for companies in all industries. Adoption of Cloud, Mobile, and Analytics promises to revolutionize the way we do business and will add value to a company’s business processes across all functions from sales, marketing, procurement, manufacturing and finance. “IT will play a significant role enabling this shift. Read this book and find out how to integrate the heart of your infrastructure, DB2 for z/OS, with new technologies in order to maximize your investment and drive new value for your customers.” Located at IBM’s Silicon Valley Laboratory, Tom is the director of IBM’s premiere relational database management system. His responsibilities include Architecture, Development, Service, and Customer Support for DB2. He leads development labs in the United States, Germany, and China. Tom works closely with IBM’s largest clients to ensure that DB2 for z/OS continues as the leading solution for modern applications, encompassing OLTP to mobile to analytics. At the same time he continues an uncompromising focus on meeting the needs of the most demanding operational environments on Earth, through DB2’s industry- leading performance, availability, scaling, and security capabilities. IBM DB2 for z/OS: The Database for Gaining a Competitive Advantage! Shantan Kethireddy Jane Man Surekha Parekh Pallavi Priyadarshini Maryela Weihrauch MC Press Online, LLC Boise, ID 83703 USA IBM DB2 for z/OS: The Database for Gaining a Competitive Advantage! Shantan Kethireddy, Jane Man, Surekha Parekh, Pallavi Priyadarshini, and Maryela Weihrauch First Edition First Printing—October 2015 © Copyright 2015 IBM.
    [Show full text]
  • IBM Infosphere Optim Data Masking Solution Mask Data on Demand to Protect Privacy Across the Enterprise
    IBM Software Solution Brief IBM InfoSphere Optim Data Masking solution Mask data on demand to protect privacy across the enterprise Today’s organizations realize that data is a critical enterprise asset, so Highlights protecting that data and the applications that hold it makes good business sense. However, different types of information have different ●● ●●Safeguard personally identifiable informa- protection and privacy requirements. Therefore, organizations must tion, trade secrets, financials and other sensitive data take a holistic approach to protecting and securing their business-critical information: ●● ●●Easily mask data on demand using predefined transformations and site-specific routines ●●●Understand where data exists: Organizations can’t protect sensitive data unless they know where it resides and how it’s related across the ●● ●●Respond in real time to suspicious enterprise. requests for data ●●●Safeguard sensitive data, both structured and unstructured: ●● ●●Ensure a valid business need to know for Structured data contained in databases must be protected from sensitive data unauthorized access using data transformation techniques such as ●● ●●Discover hidden instances of private data masking or encryption. Unstructured data in documents, forms, image so they can be fully protected files, GPS systems and more requires privacy policies to de-identify ●● ●●Support compliance with privacy regula- or mask sensitive data while still allowing needed business information tions and corporate governance standards to be shared. ●●●Protect
    [Show full text]
  • IBM Informix 14.10: the High-Performance, Low-Footprint
    Solution Brief IBM Informix 14.10 IBM Informix 14.10 The high-performance, low-footprint database for analytics on the edge, in the cloud and on premises Enterprise databases have always needed to deliver fast transaction IBM Informix delivers: processing and the replication speeds necessary for continuous availability without adding undue administrative effort or sacrificing • Powerful, optimized time series and security. Yet, new opportunities like the Internet of Things (IoT) have geospatial data management also arisen, bringing an increase in data of various types, which businesses hope to turn into competitive advantage. For that reason, • Automated administration and self-management features many companies have turned to IBM® Informix®, a solution capable of satisfying database and analytics needs at the core of the enterprise or • Footprints under 100 MB for easy IoT at the edge of your IoT network. gateway embedding • IBM InformixHQ for collaboration and IBM Informix is an embeddable, high-performance database for management across multiple instances integrating SQL, NoSQL, JSON, time series and spatial data, which can be up and running in minutes, and is accessible from virtually any • Integrated in-memory warehouse desktop, laptop or mobile device. Its small footprint—lower than 100 MB accelerator in some cases1 —and ability to run on distributed devices with a variety of automated administrative capabilities means IBM Informix is easier to install and manage with fewer administrators, even when used across thousands of devices worldwide. These features make IBM Informix the database of choice for high-performance, multidatabase installations with remote management—as is the case for IoT edge gateways.
    [Show full text]
  • Better PHP Development I
    Better PHP Development i Better PHP Development Copyright © 2017 SitePoint Pty. Ltd. Cover Design: Natalia Balska Notice of Rights All rights reserved. No part of this book may be reproduced, stored in a retrieval system or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embodied in critical articles or reviews. Notice of Liability The author and publisher have made every effort to ensure the accuracy of the information herein. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors and SitePoint Pty. Ltd., nor its dealers or distributors will be held liable for any damages to be caused either directly or indirectly by the instructions contained in this book, or by the software or hardware products described herein. Trademark Notice Rather than indicating every occurrence of a trademarked name as such, this book uses the names only in an editorial fashion and to the benefit of the trademark owner with no intention of infringement of the trademark. Published by SitePoint Pty. Ltd. 48 Cambridge Street Collingwood VIC Australia 3066 Web: www.sitepoint.com Email: [email protected] ii Better PHP Development About SitePoint SitePoint specializes in publishing fun, practical, and easy-to-understand content for web professionals. Visit http://www.sitepoint.com/ to access our blogs, books, newsletters, articles, and community forums. You’ll find a stack of information on JavaScript, PHP, design,
    [Show full text]
  • Use of Third Party Libraries Docker Postgres-9.6.6
    Docker postgres-9.6.6 - Use of Third Party Libraries Name Selected License libc-utils 0.7 (BSD) BSD-Style License libedit 20150325.3.1 (BSD) BSD-Style License libuuid 2.28.2 (BSD-3) BSD-Style License readline 6.3 (GPL) GNU General Public License alpine-baselayout 3.0.4 (GPL v2) GNU General Public License v2.0 apk-tools 2.6.9 (GPL v2) GNU General Public License v2.0 busybox 1.25.1 (GPL v2) GNU General Public License v2.0 scanelf 1.1.6 (GPL2) GNU General Public License v2.0 bash 4.3.46 (GPL v3) GNU General Public License v3.0 or later libgcrypt 1.7.9 (LGPL v2.1) GNU Library General Public License v2.0 or later libgpg-error 1.24 (LGPL v2.1) GNU Library General Public License v2.0 or later alpine-keys 1.3-r0 (MIT) MIT License (also X11) libxml2 2.9.4 (MIT) MIT License (also X11) libxslt 1.1.29 (MIT) MIT License (also X11) su-exec 0.2 (MIT) MIT License (also X11) musl 1.1.15 (MIT) MIT-Style License musl-utils 1.1.15 (MIT) MIT-Style License ncurses-libs 6.0 (MIT) MIT-Style License libcrypto1.0 1.0.2m (openssl) OpenSSL License libressl2.4-libcrypto 2.4.4 (OpenSSL) OpenSSL License libressl2.4-libssl 2.4.4 (OpenSSL) OpenSSL License libssl1.0 1.0.2m (OpenSSL) OpenSSL License tzdata 2016i (Public Domain) Public Domain postgres-9.6.6-alpine-3.5.2 (PostgreSQL) The PostgreSQL License ncurses-terminfo 6.0 (MIT) X11 License ncurses-terminfo-base 6.0 (MIT) X11 License zlib 1.2.11 (zlib) zlib License Docker postgres-9.6.6 - Third-Party Notices Report [alpine-baselayout 3.0.4 (GPL v2)] Copyright Statements TOC 1.3.1 1 License Agreements Recipients who would like to receive a copy of such source code should submit a request to Tripwire by email, at [email protected].
    [Show full text]