php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23325 PHP can't connect if db name has dashes
Submitted: 2003-04-24 06:20 UTC Modified: 2003-05-09 07:35 UTC
Votes:5
Avg. Score:4.2 ± 0.7
Reproduced:5 of 5 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: fritz at lateral dot net Assigned:
Status: No Feedback Package: MSSQL related
PHP Version: 4.3.1 OS: Win 2000
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
29 - 6 = ?
Subscribe to this entry?

 
 [2003-04-24 06:20 UTC] fritz at lateral dot net
If the name of the database has a dash in it, e.g. php-bugs-list, php running under apache is not able to connect - I can connect using ASP in IIS.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-25 12:23 UTC] sniper@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.



 [2003-04-28 07:05 UTC] fritz at lateral dot net
What do you mean, 'Not enough information was 
provided'???

It's very simple - the category is MSSQL related.
The OS is Win 2000.
If the name of the (MSSQL) database contains dashes, a 
PHP page running under Apache cannot connect to it.
If I try connecting to it from an ASP, page running 
under IIS, I can connect allright.
If I rename the database and remove the dashes I can 
connect from either PHP/Apache or IIS/ASP.

What other information do you need? My star sign is 
aquarius. I was wearing grey socks when the error 
occured.... ?!!?
 [2003-04-28 07:11 UTC] derick@php.net
my my my... what a nice attitude we have again. From the "How to report a bug" page:

    * Provide code that demonstrates the problem, it should almost never be more than ten lines long. Anything longer probably contains a lot of code that has nothing to do with the problem, which just makes it take longer to figure out the real problem. (But don't forget to make sure that your code still demonstrates the bug you're reporting and doesn't have some other problem because you've accidently trimmed out something you thought wasn't important but was!)

The URL for this is: http://bugs.php.net/how-to-report.php

Don't forget we're volunteers and are not particulary fond of people who start shouting and demand a fix while they are not willing to produce a useful bugreport.
 [2003-04-28 07:29 UTC] fritz at lateral dot net
Try creating a database called php-bugs-list and one 
called php_bugs_list.

mssql_connect('localhost','username','pwd') or die 
'mssql_connect error';
mssql_select_db('php-bugs-list') or die 
'mssql_select_db error';

mssql_connect('localhost','username','pwd') or die 
'mssql_connect error';
mssql_select_db('php_bugs_list') or die 
'mssql_select_db error';

I am not 'demanding' a fix - I have learnt that I will 
avoid errors by having no dashes in the database name. 
My problem is solved.
I tried to share this with other php users, If you want 
to use this information to improve php you are welcome 
to it - but please don't waste my time by being anal 
about how the bug is reported.

And that's the end of it, AFAIAC.
 [2003-05-09 07:35 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2006-10-10 18:00 UTC] chris at sugarcrm dot com
2006 - PHP 4.4.2/4 and PHP 5.1.2/4 still have this issue.

The same code use-case is valid: try to connect to a MSSql database with dashes in the name, and the connection will fail.
 [2007-11-30 17:40 UTC] byoung at bigbluehat dot com
2007 - PHP 5.2.3 still have this issue.

Connection to MSSQL databases with dash continues to fail (using FreeTDS 0.63). Databases without dashes in the name connect without error.
 [2008-06-03 21:21 UTC] donnyk at gmail dot com
This bug still exists in 5.2.6, code to reproduce remains the same.

mssql_select_db('mysilly-database'); will result in an error claiming that mysilly does not exist within sysdatabases (a mssql system table).
 [2009-10-16 11:50 UTC] yetihehe at yetihehe dot com
Problem exists also when trying to use odbc+freetds with any method (odbc_connect, new PDO("odbc:...")) under linux, php 5.2.4. Connecting using external programs works.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 14:01:31 2024 UTC