PHP中PDO连接数据库中各种DNS设置方法 PHP中PDO连接数据库中各种DNS设置方法小结
潇湘竹叶 人气:0本文实例总结了PHP中PDO连接数据库中各种DNS设置方法。分享给大家供大家参考,具体如下:
pdo中DNS书写方式如下:
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};DATABASE=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:dbname=//localhost:1521/mydb
odbc:testdb
odbc:DRIVER={IBM DB2 ODBC DRIVER};HOSTNAME=localhost;PORT=50000;DATABASE=SAMPLE;PROTOCOL=TCPIP;UID=db2inst1;PWD=ibmdb2;
odbc:Driver={Microsoft Access Driver (*.mdb)};Dbq=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
希望本文所述对大家PHP程序设计有所帮助。
加载全部内容