A summary of various DNS setup methods in PDO connection database in PHP _php tips

Source: Internet
Author: User
Tags db2 db2 odbc driver ibm db2 ibm db2 odbc driver odbc sqlite

This article summarizes various DNS setting methods in PDO connection database in PHP. Share to everyone for your reference, specific as follows:

The DNS writing method in PDO is as follows:

MSSQL: Host=localhost;dbname=testdb

Sybase: Host=localhost;dbname=testdb

dblib: Host=localhost;dbname=testdb

Firebird: User=john; Password=mypass;database=database. Gde;datasource=localhost; port=305
DRIVER={IBM DB2 ODBC DRIVER};D atabase=database; Hostname=hostname; Port=port; Protocol=tcpip; Uid=username; Pwd=password;

Informix: host=host.domain.com; service=9800;
database=common_db; Server=ids_server; PROTOCOL=ONSOCTCP;
Enablescrollablecursors=1

MySQL: host=localhost;port=3307;dbname=testdb

MySQL: unix_socket=/tmp/mysql.sock;dbname=testdb

OCI:d bname=//localhost:1521/mydb

ODBC: TestDB

ODBC:D RIVER={IBM DB2 ODBC DRIVER}; Hostname=localhost; Port=50000;database=sample; Protocol=tcpip; Uid=db2inst1; PWD=IBMDB2;

ODBC:D river={microsoft Access Driver (*.mdb)};D Bq=c:\\db.mdb; Uid=admin

pgsql: host=localhost port=5432 dbname=testdb user=bruce password=mypass

SQLite:/opt/databases/mydb.sq3
Sqlite::memory:
Sqlite2:/opt/databases/mydb.sq2
Sqlite2::memory

More about PHP Interested readers can view the site topics: "PHP based on PDO Operation Database Skills Summary", "PHP+MONGODB Database Operation Skills Encyclopedia", "PHP object-oriented Programming Program Introduction", "PHP string (String) Usage Summary", " Introduction to PHP+MYSQL Database operations and a summary of PHP common database operations Tips

I hope this article will help you with the PHP program design.

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.