MySQL Forums
Forum List  »  Newbie

Access denied for user ''@'localhost' to database 'zalekdb'
Posted by: zalek Bloom
Date: February 22, 2011 03:05PM

I wrote a simple Java application which tries to access mySQL. mySQL is located on my PC and 'zalekdb' database exists - I can access it using mySQL workbench (without password). I am testing in in Netbeans with Glassfish v3 sever.

In my Java I have a code:
connect = DriverManager.getConnection (w_url,"zalek", "");

When I try to execute this servlet I am getting:

Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Access denied for user ''@'localhost' to database 'zalekdb'

My question - how come the message points to user ''@'localhost', if in my program I am using using user="zalek":
connect = DriverManager.getConnection (w_url,"zalek", "");



Options: ReplyQuote

Written By
Access denied for user ''@'localhost' to database 'zalekdb'
February 22, 2011 03:05PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.