[英]Connecting to SQL Server with PDO_MSSQL in PHP
I have a problem while trying to connect to my SQL Server 2000 database using pdo_mssql with this line: 尝试通过以下行使用pdo_mssql连接到我的SQL Server 2000数据库时遇到问题:
$connection = new PDO ('mssql:host=localhost;dbname=DNAME', 'user', 'password');
The exception is the following: 例外情况如下:
PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] General SQL Server error: Check messages from the SQL Server. (severity 5)' in C:\Inetpub\wwwroot\public\test.php:2 Stack trace: #0 C:\Inetpub\wwwroot\public\test.php(2): PDO->__construct('mssql:host=loca...', 'user', 'password') #1 {main} thrown in C:\Inetpub\wwwroot\public\test.php on line 2
If I make the connection using the function mssql_connect() as follows, I obtain no error and my connection is correctly made: 如果按如下所示使用函数mssql_connect()建立连接,则不会出现任何错误,并且连接正确:
$link = mssql_connect ('localhost', 'user', 'password');
Any idea? 任何想法? Where can I read the detailed error message?
在哪里可以阅读详细的错误消息? Thanks
谢谢
我的数据库名称带有字符“-”,删除它可以解决问题!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.