【发布时间】:2010-09-19 05:43:00
【问题描述】:
当我使用 PDO 连接到 MySQL 数据库时,我需要的连接方式是:
$pdoConnection = new PDO("mysql:host=hostname;dbname=databasename",user,password);
但是,对于 PostgreSQL,DSN 更加标准(IMO):
$pdoConnection = new PDO("pgsql:host=hostname;dbname=databasename;user=username;password=thepassword");
MySQL 不能使用单个字符串有什么原因吗?或者这仅仅是因为我使用的版本(PHP 5.2、MySQL 5.0、PostgreSQL 8.1)?
【问题讨论】:
标签: php mysql postgresql pdo