PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Database » DB » Bug #2140

Bad syntax in mssql for connection to SQL Server 2000 for non-standard port

Details

Submitted2004-08-16 21:16 UTC
Fromrussell at keppner dot net
Assigneddanielc
StatusClosed
PackageDB
PHP Version4.3.8
OSWindows
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