aspose file tools*
The moose likes JDBC and the fly likes Java MySQL connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Java MySQL connection" Watch "Java MySQL connection" New topic
Author

Java MySQL connection

Thomas Greene
Ranch Hand

Joined: Aug 09, 2004
Posts: 125
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@127.0.0.1 (Using password:YES).

But i can directly run the database from prompt.

Please Help
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29287
    
140

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


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, 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 127.0.0.1 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.

    Jules
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Java MySQL connection
     
    Similar Threads
    MySql Connection
    Modify persistence.xml file runtime
    Database Connection
    can't connect to mysql datasource in jboss
    Unable to load database schema in Jboss Dev Seam Project