Chapter 4: Architecture of an Intranet Application This framework is provided with the CD-ROM. You don t need to create it from scratch. Also note that the database abstraction uses DB.phpfrom the PEAR. Now let s create the classes needed to implement this application framework. Creating a Database Abstraction Class Accessing a database using its own API is common in the PHP world. For example, most PHP developers use PHP with MySQL and, therefore, they write code that is specific to the MySQL API found in PHP. There is nothing wrong with this approach if you know that your PHP applications will be used only for the MySQL database server. However, if there is a chance that your applications will be used with other databases such as Oracle, Postgres, and so forth, you need to avoid MySQL-specific API. A developer who has abstracted the database API in a level above the vendor-specific API can enjoy the speed of porting the application to different relational databases. Here, we will create a class called class.DBI.php that will implement a database abstraction layer for our application framework. Listing 4-1 shows class.DBI.php, which implements the database abstraction using PEAR DB. See http://pear.php.net/manual/en/core.db.phpfor details on PEAR DB, a unified API for accessing SQL-databases. Listing 4-1: class.DBI.php Note: If you are looking for best quality webspace to host and run your tomcat application check Vision tomcat hosting services