php5 ms sql server 2005
Posted: Sun Sep 02, 2007 11:25 pm
Hey guys,
I have previously made a connection from php on a linux server to sql server 2000 on a windows box using the freeTDS library, I had success in this and it worked fine. I'm now trying to do a similar thing except connect to sql server 2005. I can't get it to work on this configuration. I'm using pdo_dblib to connect, and have made the following sample file to test the connection. It should be noted that I've successfully connected remotely using Management Studio 2005, so the details I'm using are correct, and it appears that it's connecting initially because if I use an incorrect password for example I get a login error instead of the error below.
The error I continue to get is
I have previously made a connection from php on a linux server to sql server 2000 on a windows box using the freeTDS library, I had success in this and it worked fine. I'm now trying to do a similar thing except connect to sql server 2005. I can't get it to work on this configuration. I'm using pdo_dblib to connect, and have made the following sample file to test the connection. It should be noted that I've successfully connected remotely using Management Studio 2005, so the details I'm using are correct, and it appears that it's connecting initially because if I use an incorrect password for example I get a login error instead of the error below.
Code: Select all
try {
$hostname = "***.***.**.**";
$port = ****;
$dbname = "***";
$username = "***";
$pw = "***";
$pdo = new PDO("dblib:host=$hostname:$port;dbname=$dbname","$username","$pw");
} catch (PDOException $e) {
echo "Failed to get DB handle: " . $e->getMessage() . "\n";
exit;
}Any help would be appreciated, thanks.Failed to get DB handle: SQLSTATE[HY000] General SQL Server error: Check messages from the SQL Server. (severity 5)