4 messages in com.mysql.lists.javaRe: question concerning connection to...
FromSent OnAttachments
Björn Lorenz02 May 2003 06:06 
Mark Matthews02 May 2003 06:36 
Shankar Unni02 May 2003 08:53 
Mark Matthews02 May 2003 09:00 
Subject:Re: question concerning connection to mysql
From:Mark Matthews (ma@mysql.com)
Date:05/02/2003 06:36:53 AM
List:com.mysql.lists.java

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

Björn Lorenz wrote:

Hi all!

I am working with java/Connector J 2.* and mysql 3.53. When I want someone to connect to the database from my java-Programm

and this fails, I do not know how to find out why this failed (wrong pwd, wrong UserName, etc.).

I would really like to create my own exceptions like (wrong logInName or something) but do not know how to. DriverManger.getConnection(String url, String userName, String pwd) only returns a "general" error - right?

Thanks for all help,

björn

If you have an authentication problem, you will get an exception that has a message something along the lines of 'Access Denied', with a SQLState of "28000".

MySQL does not tell you whether the login name or the password is incorrect, only that the combination of the two didn't work. To do anything else would be a security hazard. If someone was trying to break into your system, once they knew that a login name was valid, they could then brute-force guess the password. If all they know is that either the login name or the password is not correct, it is harder to guess either.

-Mark

- -- For technical support contracts, visit https://order.mysql.com/?ref=mmma

iD8DBQE+snSLtvXNTca6JD8RAshwAJ9bfSKKA+HC/OVAuF8LuEKxz0a8LQCfXWpo IV1TD/kHl9dEd2sDpuY6dQ4= =INDv -----END PGP SIGNATURE-----