Skip to Content.
Sympa Menu

freetds - Error with database containing "-" in database name

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Stefan Sonnenberg-Carstens" <s.sonnenberg AT coolspot.de>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: Error with database containing "-" in database name
  • Date: Wed, 3 Jul 2002 06:04:34 -0400


Hi folks,
We have a database named "p-customers".
I used the following PHP code to connect and query :

$con = mssql_pconnect("MSSQL","xxx","xxx");
mssql_select_db('p-customers');
$res = mssql_query("SELECT TOP 100 * FROM websites");
$count = 0;
while($row = mssql_fetch_row($res)) {
echo $row[0] ." <-> " . $row[2] ."<br>\n";
$count++;
}
When I execute the script, I get the following reply :

>>>>
Warning: Sybase: Server message: Could not locate entry in sysdatabases
for database 'p'. No entry found with that name. Make sure that the name
is entered correctly. (severity 16, procedure N/A) in
/var/www/html/sql_test.php on line 13
>>>>

We are using PHP 4.2.1 with FreeTDS 0.53 / Apache 1.3.26 on Mandrake 8.2
with kernel 2.4.18-6mdk.

If we take databases with no dashes in the names, it works perfect !
I tried to mask the dashes by "\" or with ", but without success.



What is wrong ?







Archive powered by MHonArc 2.6.24.

Top of Page