当我使用 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)?