1

I have a problem while trying to connect to my SQL Server 2000 database using pdo_mssql with this line:

$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:

$link = mssql_connect ('localhost', 'user', 'password');

Any idea? Where can I read the detailed error message? Thanks

j0k
  • 22,303
  • 28
  • 77
  • 86
Joaquín L. Robles
  • 5,888
  • 8
  • 60
  • 91

1 Answers1

1

My database name had the character "-", removing it solved the problem!

Joaquín L. Robles
  • 5,888
  • 8
  • 60
  • 91
  • Same problem here... but cannot remove "-" from database name. Tried connection on another DB and works very well. – NBPalomino Oct 06 '15 at 15:51