Home » Database » DB » Bug #2140
Bad syntax in mssql for connection to SQL Server 2000 for non-standard port
Details
| Submitted | 2004-08-16 21:16 UTC |
|---|---|
| From | russell at keppner dot net |
| Assigned | danielc |
| Status | Closed |
| Package | DB |
| PHP Version | 4.3.8 |
| OS | Windows |
| Roadmaps | (Not assigned) |
Comments
[2004-08-16 21:16 UTC] russell at keppner dot net
Description:
------------
Using DB 1.6.1 on Windows XP against MS SQL server 2000 using phptype mssql. Won't connect on a non-standard port, because it's using the wrong syntax, at least for XP to SQL 2000. I.E. Server name/port number is normally denoted like "mysqlsrv01:1234", but this wants "mysqlsrv01,1234". The code in question is line 86 of mssql.php.
Reproduce code:
---------------
<?php
require_once 'DB.php';
// same result with either DSN
$dsn = array(
'phptype' => 'mssql',
'username' => 'user',
'password' => 'password',
'hostspec' => SQL_SERVER_NAME',
'port' => 1234,
'database' => 'database_name'
);
// $dsn = 'mssql://user:passwd@SQL_SERVER_NAME:1234/database_name';
$db =& DB::connect($dsn);
if (DB::isError($db)) {
die($db->getMessage());
} else {
echo "Connection succeeded.";
}
?>
Expected result:
----------------
Connection succeeded.
Actual result:
--------------
DB Error: connect failed