OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
'ODBC''localhost' instead of 'root''invalid_hostname.com' ?!??

From: Martin Olsson (mnemominimum.se)
Date: Sun Aug 21 2005 - 16:08:59 CDT


Hi,

I'm using PHP/MySQL to development a web-based application. I just
upgraded both PHP and MySQL and I noticed that some of my MySQL calls
are now broken and I don't see any easy way to fix them.

My script calls mysql_connect() and does very careful error checking.
It's important that I can tell apart invalid hostname errors from say
incorrect username/password errors. Previously, I did this by checking
mysql_errno(), where 2003 would mean bad hostname and 1045 would
indicate bad username/password.

In the latest PHP/MySQL bundle I downloaded this functionality changed
though. In this new version, whenever I feed it with a invalid hostname
it will fallback to localhost (where I actually have a database running)
and then it will subsequently report a 1045 instead of a 2003.

Oddly enough, the exact error message (mysql_error) I get attached to
this 1045 says; mysql_error()==

Access denied for user 'ODBC''localhost' (using password: NO)

Now, what is this about? I sure did not feed it with a username 'ODBC'.
I do use Windows 2005 but how could ODBC possibly be related to this? (I
assume ODBC means that [Microsoft?] database connection thing, I'm not
sure exactly what is it; i've never used it). For the record, the actual
username I specified in the call with the invalid hostname was "root".

---

So, the question is how can I tell these errors apart?

Why is mysql_error() reporting back that it tried to connect to
localhost as user "ODBC" when I asked it to connect to an invalid
hostname as user "root" ?!?!

sincerly,
martin

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql