Using a Java program, I can connect to the test database in MySQL. The
test database is installed using a MySQL utility, and it can be accessed
by any user without supplying a password. The relevant lines in my Java
(Java version 1.4.1) code are:
Connection con = null;
String url = "jdbc:mysql:///test"; // <== no user or password specified
con = DriverManager.getConnection(url);
However, when I try to connect to the accounting database (built as one
follows the Larry Ullman's "MySQL" book), the program fails. I need to
supply a user and a password. The relevant lines are now:
Connection con = null;
String url = "jdbc:mysql:///accounting?user=root&password=pswd"; // <==
con = DriverManager.getConnection(url);
I cannot get a connection. The error message is:
"Invalid authorization specification: Access denied for user:
'root@thorvald' (Using password: YES)"
(thorvald is my machine name.)
I have tried all sorts of variations on the url, trying to access the
accounting database, with no success. I can use the same user/password
of root/pswd within the mysql monitor to access anything I want.
Any ideas?
Again, I am using Linux (Redhat 9) , Java 1.4.1, MySQL 4.0.13, and the
MySQL ConnectorJ 3.0.8 (for Java access to MySQL).
Cheers,
Mark |