Pear::D B is the choice of a ADODB database, in addition to the Postgres, this article describes how to use DB to join the database with an example
Installing pear is not covered in this article. In pear, the class that joins the database has the following:
1 "MDB";
2 "MDB2: Because MDB2 's author has been looking forward to PDO into release status, so far MDB2 has been beta version;"
3 "PDO: Connection speed should be the fastest, is a C module, but has not been released; I heard that in the PHP5.1 has been used as a formal module for database-driven;
4 "DB";
Install DB:
Installing the DB process under Debian is simple:
#>su
#>pear install DB;
Install Ok:db
When you are finished installing, you can edit the following test.php file in the editor:
<?php
Include_once (' db.php ');
$DSN = Array (
' Phptype ' => ' pgsql ',
' username ' => ' XXXXXX ',
' Password ' => ' XXXXXXX ',
' Hostspec ' => ' XX. Xxxxx. COM ',
' Port ' => ' 5432 ',
' Database ' => ' test '
);
$options = Array (
' Debug ' => 2,
' Portability ' => db_portability_all,
);
$db =& New db;
$db->connect ($DSN, $options);
if (Pear::iserror ($db)) {
Die ($db->getmessage ());
}else{echo ' Dbconnect ok! ';}
$db->disconnect;
?>
Well, experiment in your browser:
http://localhost/test.php
How to: you should see:
Dbconnect ok!
Congratulations, you've succeeded.
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.