Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

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

843859Apr 21 2007 — edited Apr 23 2007
Hi all,

I'm trying to connect to MySql Server 5.0 using a java servlet, and it is coming up with the access denied error, which I think it is to do with the java code connection.
Class.forName("com.mysql.jdbc.Driver");

conn = DriverManager.getConnection("jdbc:mysql://localhost:8080/accounts" +
                                   "user=admin&password=whatever");
When i run the servlet http://localhost:8080 and invoke submit it comes up with:

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

which makes me think that the username and password is not being sent correctly/error in the java code connection itself. The privileges etc have been set up on mysql:

GRANT ALL PRIVLEGES ON ACCOUNTS TO 'admin'@'localhost:8080' IDENTIFIED BY 'whatever';


The tomcat server resides on localhost on port 8080 and the dbse name is ACCOUNTS.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 21 2007
Added on Apr 21 2007
6 comments
2,243 views