PHP中PDO连接数据库中各种DNS设置方法小结

yipeiwu_com6年前PHP代码库

本文实例总结了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相关内容感兴趣的读者可查看本站专题:《PHP基于pdo操作数据库技巧总结》、《PHP+MongoDB数据库操作技巧大全》、《php面向对象程序设计入门教程》、《php字符串(string)用法总结》、《php+mysql数据库操作入门教程》及《php常见数据库操作技巧汇总

希望本文所述对大家PHP程序设计有所帮助。

相关文章

解决file_get_contents无法请求https连接的方法

错误: Warning: fopen() [function.fopen]: Unable to find the wrapper "https" - did you forget to...

apache和php之间协同工作的配置经验分享

php在当今一个不陌生的网络技术名词,想到网站或者web可能大多数开发者都会想到php,一个既免费又开源,既容易又实用等一些好处才拥有了世界上很多IT技术人员的青睐,我是一名JAVA开发...

PHP简单读取xml文件的方法示例

本文实例讲述了PHP简单读取xml文件的方法。分享给大家供大家参考,具体如下: 我将软件版本更新中的版本号等数据信息存放在xml文件中,使用时将版本信息读取出来。 xml文件内容如下:...

PHP版自动生成文章摘要

自动生成文章摘要[JavaScript 版本]。 我们在写BLOG这样的程序时经常需要显示文章前一部分的,但是又怕不恰当的截断破坏封闭标签以造成整 个文档结构破坏,使用我的函数...

php将从数据库中获得的数据转换成json格式并输出的方法

如下所示: header('content-type:application/json;charset=utf8'); $results = array(); while ($...