I'm trying to access an MS SQL db using DB::connect. It takes a connection string. I can connect to several db's served by my MS SQL Server, but not the db that has a space in its name. For example:
$user = 'sa';
$pass = '';
$host = 'localhost';
$db_name = 'CStore Server';
$dsn = "mssql://$user:$pass@$host/$db_name";
// DB::connect will return a PEAR DB object on success
// or a PEAR DB Error object on error
$db = DB::connect($dsn);
if (DB::isError($db)) {
$errStr = $db->getMessage() . $db->getDebugInfo ();
return FALSE;
}
The error from MS SQL Server says that it cannot find the database called 'CStore'. I print out the dsn, and it looks correct. As I said, I can connect to other db's served by the server, but those db's don't have spaces in their names.
Suggestions (other than renaming the db)? Thanks.