jQuery in Action, 3rd edition
The moose likes JDBC and Relational Databases and the fly likes Java MySQL connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Java MySQL connection" Watch "Java MySQL connection" New topic

Java MySQL connection

Thomas Greene
Ranch Hand

Joined: Aug 09, 2004
Posts: 127
I am trying to connect java application with mysql.
Earlier mysql was installed on a remote machine and the connection was working fine. But now i was testing it by installing it on the local machine. So changed the host name from name of server to localhost and specified user name and password for local mysql database.
But now i can't conenct to the local databse.
i am getting the following Error

Access denied to user abc@ (Using password:YES).

But i can directly run the database from prompt.

Please Help
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33102

Do you have a firewall on your local machine? Maybe it is blocking the port Mysql is using?

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
I had a problem like this the first time I used MySQL, but it was a couple of years ago and I can't remember the exact cause. Here are my suggestions:
  • Try instead of localhost to bypass the DNS lookup
  • You may need to set stuff like SocketPermission and something else in the policy file of your app server

  • I'm afraid that's all I can remember.

    I agree. Here's the link: http://aspose.com/file-tools
    subject: Java MySQL connection
    It's not a secret anymore!