PHP PDO class Troubleshooting Database Connectivity _php Tutorial

Source: Internet
Author: User
Tags ibm db2
For first Contact

Pod extensions are added in PHP5, which provides the PHP PDO class to access the database, using the same method name for different databases and resolving the problem of a database connection not being unified.

Target of the PHP PDO class

Provides a lightweight, clear, and convenient API
Unify the common features of different RDBMS libraries, but not exclude more advanced features.
Provides an optional, large degree of abstraction/compatibility through PHP scripting.

Features of the PHP PDO class:

Performance. PDO has learned from the outset the successes and failures of existing database extensions. Because PDO's code is brand new, we have the opportunity to start designing performance again to take advantage of the latest features of PHP 5.
Ability. PDO is designed to provide the basis for common database functionality while providing easy access to the unique features of the RDBMS.
Simple. PDO is designed to make it easy to use your database. The API does not force you into your code, and it clearly shows the process of each function call.
The runtime is extensible. The PDO extension is modular, allowing you to load drivers at run time for your database backend without having to recompile or reinstall the entire PHP program. For example, the PDO_OCI extension implements the Oracle database API instead of the PDO extension. There are also drivers for MySQL, PostgreSQL, ODBC, and Firebird, and more drivers are still being developed. [Separator]

Installing the PHP PDO class

I am here for the PDO extension under Windows development, if you want to install the configuration under Linux, please look elsewhere.

Version requirements: php5.1 and later version of the package has been brought, php5.0.x to pecl.php.net to download, put in your extension library, PHP is located in the folder of the Ext folder, the manual said the version before 5.0 can not run the PDO extension.

Configuration:

Modify your php.ini profile so that it supports PDO. (php.ini this thing is not understood, first figure out, to modify the call your Phpinfo () function shows the php.ini) extension=php_ Pdo.dll in front of the semicolon is removed, the other is a PHP configuration file comment symbol, this extension is necessary. and down there.

; Extension=php_pdo.dll
; Extension=php_pdo_firebird.dll
; Extension=php_pdo_informix.dll
; Extension=php_pdo_mssql.dll
; Extension=php_pdo_mysql.dll
; Extension=php_pdo_oci.dll
; Extension=php_pdo_oci8.dll
; Extension=php_pdo_odbc.dll
; Extension=php_pdo_pgsql.dll
; Extension=php_pdo_sqlite.dll

The database corresponding to the PHP PDO class extension is:

Driver name supported databases
Pdo_dblib Freetds/microsoft SQL Server/sybase
Pdo_firebird Firebird/interbase 6
Pdo_informix IBM INFORMIX Dynamic Server
Pdo_mysql MYSQL 3.x/4.x
Pdo_oci Oracle Call Interface
PDO_ODBC ODBC v3 (IBM DB2, UnixODBC and Win32 ODBC)
Pdo_pgsql PostgreSQL
Pdo_sqlite SQLite 3 and SQLite 2

What kind of database would you like to use, as long as you put the appropriate pre-extension comment symbol ";" get rid of it.


http://www.bkjia.com/PHPjc/446026.html www.bkjia.com true http://www.bkjia.com/PHPjc/446026.html techarticle for the first contact pod extension is added in the PHP5, the extension provides the PHP PDO class to access the database, different databases using the same method name, to resolve the database connection is not uniform ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.