I am trying to connect MySQL server with JDBC. I am using JVM 1.4. When I
run my programm I am getting following exception:
java.sql.SQLException: Invalid authorization specification: Access denied
for us
er: 'user@host' (Using password: YES)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:659)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1562)
at com.mysql.jdbc.Connection.<init>(Connection.java:491)
at
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
:346)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at test.main(test.java:14)
I am using a valid user name and password to connect to the server. But I
was able to connect to the database with same programm with JVM 1.3.
What I have to do to connect to the database without above exception?? Any
idea or hint????
Thankx in advance.
Manmohan
Assuming that nothing have been changed in your program code, I don't know
if this is the problem, but the bytecode is different from JVM 1.4 and
1.3...
What happens if you compile with -target option?
G
my guess is: you've got the wrong driver.
i use the one from mysql.com you can get it at
http://www.mysql.com/downloads/api-jdbc-stable.html
put the jar into your classpath and register it via
DriverManager.registerDriver(new org.gjt.mm.mysql.Driver());
you may then get a connection with
DriverManager.getConnection(url,user,pass);
this works fine here.
just for the case: did you try to login with any different client?
perhaps it's a configuration thing ...
hth,
tobi
The problem is I can only connect to dabase using the root of mysql. None of
the other users will fail.
Any one can help me?
The GRANT statement can be used to do this.
I have got a similar problem.
First I was using the driver mysql-connector-3.02-beta.
I got a similar authorization failure (password wrong). But the first
three letters of the user had been cut (using 'martin' as the user, the
system notified 'tin'). When I worked with a blank password the system
stopped without any answer.
Now I downloaded the driver mysql-connector-3.08-stable.
Now I got a totally different failure.
The system reponded:
Java.ioException: Unexpected end of input-stream
Is anybody able to help me?
Thanks a lot
Martin
--
Posted via http://dbforums.com
I loaded the driver by
Class.forName("com.mysql.jdbc.Driver").newInstance();
Before I loaded the driver com.mysql.jdbc.Driver by a property opject.
I built the connection by
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/-
test?user=monty&password=greatsqldb");
Before I built the connection by
connection conn = DriverManager.getConnection(url,dbuser,dbpwd)
There must be a difference in the driver versions, but I am too tired
now to check the differences. I am just happy my system is working.
Greetings from munich (Octoberfest is coming up now!)