PHP is one of the most popular languages for Web applications, and now you can use it to access your U2 data. In part 1 of this series, you learned how to create a PHP Data Objects driver for U2. Now, learn how to put the driver you've created to use in a PHP application.
Introduction
With the PDO driver for U2 written in part 1 of this series, your PHP applications can:
* Connect to one or more servers
* Retrieve marks
* Access files and records
* Execute database commands
* Run U2 Basic programs
In this article, you'll develop a small project to demonstrate how to use the driver.
The PHP Data Objects (PDO) extension provides a lightweight, convenient means for accessing databases in PHP. However, you must use a database-specific PDO driver to access a database server. Currently there is no PDO driver for the IBM® U2 data servers, Uni Data® and UniVerse®. In this article, you'll learn how to write a PDO driver for U2 using the U2 native interface, InterCall. With this PDO driver, U2 users can develop PHP applications that access U2 data quickly and easily.
Introduction
PHP is a widely used open source general-purpose scripting language that is especially well-suited for Web development and can be embedded into HTML. According to a survey by www.nexen.net for April 2006, on worldwide Internet Web sites, PHP is found on 35.44% of Web sites. PHP is the fastest growing server-side language.
A number of factors have contributed to PHP's success:
* Open source
* Multi-platform support
* Raw 3x to 4x performance advantage over JSP (source: eWeek), which translates directly to hardware savings
* 2x to 5x development time advantage over JSP (source: PerlMonth), which translates directly to software development resource savings
* Integration with Java EJBs and servlets, as well as database access, SOAP, and XML
However, there's no direct way to access data on U2 data servers from PHP. Luckily, the PHP PDO extension provides a means to accomplish U2 data access. We will first discuss PDO objects and how to use them to access a database, followed by a specific example of building a U2 PDO driver in C language using U2's InterCall interface.
German slides of the talk "Einführung in PHP 5 und IBM DB2"
Service Data Objects (SDOs) have been around in the Java™ technology world since November 2003. They are designed as a means of simplifying and unifying working with heterogeneous data sources. In February 2005, IBM and Zend announced a strategic partnership to collaborate on the development and support of the PHP environment. One aspect of this collaboration has been the definition and implementation of SDOs for PHP. This article gives an overview of SDOs and the motivations for using them in the PHP environment. A simple contact management scenario is used to illustrate key concepts.
MySQL is an open source database that has gained popularity in the web application world and is used in most of the leading/hot PHP (Hypertext Pre Processor) applications. Now that System i is a supported hardware platform for PHP with the availability of Zend Core for i5/OS, we have documented instructions for downloading, installing and running MySQL in the Portable Application Solution Environment (PASE) on the System i. MySQL is not an IBM i5/OS supported environment, use accordingly.
Learn about PHP database application development on i5/OS® using the Zend Core for i5/OS product. Also, learn how to install Zend Core, and deploy and run a PHP script to access data stored in a DB2® Universal Database™ (DB2 UDB) for iSeries™ database.
Every now and then you find a gem stuffed way back in the back of the forums. I came across this one and since it solves a problem that I've seen asked more than once I thought I'd post it here for all to see. This was original posted by Mike Smith of IBM. Many thanks to Mike for this informative post.
For those of you who read the entire thread, I do have confirmation from IBM that the problem pointed out near the bottom of the thread is fixed in the latest beta.
PHP is one of the world's most popular programming languages for building dynamic data-driven Web applications, and IBM data servers store a majority of the world's data -- combining these two technologies is a natural step for any Web developer.
This IBM Rebook provides the technics and examples for creating PHP applications with DB2, Informix IDS, and Cloudscape using various database interfaces including PDO, ibm_db2, Unified ODBC, Informix functions, and unixODBC, etc.
We describes the installation and configuration details for setting up the IBM data servers and Apache Web application server for PHP applications. Zend Core for IBM, Zend Studio installation and configuration are also included.
In addition, we discuss the process of porting PHP applications from MySQL 5 to DB2 UDB V8.2.
Table of Contents
Chapter 1. Technology overview
Chapter 2. Sample scenario description
Chapter 3. Zend installation and configuration
Chapter 4. PHP application development with DB2
Chapter 5. PHP applications with Informix database servers
Chapter 6. Porting PHP applicaiton from MySQL V5 to DB2 UDB V8.2
Appendix A. An introduction to Service Data Objects for PHP
In a previous series of articles, I covered the IBM® DB2® Universal DatabaseTM (DB2 UDB) plug-in for Microsoft® Visual Studio .NET that lets Microsoft-trained application developers quickly develop .NET applications that run against DB2 UDB databases, whether they reside on the z/OS®, i5/OSTM, AIX®, Windows®, Linux®, HP-UX, or Solaris operating systems. "Universal" is truly an appropriate part of the DB2 UDB name because the approach used for application development in DB2 UDB is basically: you pick the programming language and we will give you the best integration into that environment that we can.
In this article, I explore the features that make programming PHP-based DB2 UDB applications as seamless as possible and ultimately shorten the development cycle for these types of applications.
Learn about the effectiveness of using the native XML capabilities coming in the next version of DB2® Universal Database™ for Linux®, UNIX®, and Windows® to simplify application code and the relational schemas. This article looks at the impact of schema evolution on the application and walks the reader through a usage scenario to illustrate the ease of setting up a PHP environment; the ease of integrating DB2 native XML functionality with PHP applications, including Web services written in PHP and XQuery; and the benefit of pushing the business logic and data transformations into the database, using XQuery, stored procedures, and views. To highlight the impact of using DB2 native XML support on PHP application code and relational schema design, the scenario creates a parallel environment using a database that does not have any XML capabilities (for example, MySQL). We show the difference in the application code, database queries, and the relational schemas for the two environments.








