File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Cannot connect to MySQL5 with connector-java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Cannot connect to MySQL5 with connector-java" Watch "Cannot connect to MySQL5 with connector-java" New topic
Author

Cannot connect to MySQL5 with connector-java

Gergo Csaki
Greenhorn

Joined: Sep 24, 2005
Posts: 13
Hi,

Does anyone have an idea, why can't I connect to MySQL5 with neither mysql-connctor-java 3.12.x, nor mysql-connector-java 5.x (dev version)?

I can connect to MySQL4.1.11 using any of the drivers, but when I try to connect to a MySQL5 db using the same code and syntax, it fails:
"STACKTRACE:
java.net.SocketException: java.net.ConnectException: Connection refused"

The MySQL log is empty. MySQL server listens on the standard 3306 port. I'm using Linux boxes running jre1.5.0_06-b05. Access righs, passwords, etc are OK, servers are runnig , no firewalls in the way, I can connect to them with other non-java clients.

What am I doing wrong?

Regards,
Brian
fred Joly
Ranch Hand

Joined: Jan 19, 2006
Posts: 55
If it's a new installation, you should look in the "my.cnf" file
(/etc/mysql/my.cnf on my computer but it might be somewhere else)
The line wich says "skip-networking" should be commented (#skip-networking) in order for jbdc to work.
Gergo Csaki
Greenhorn

Joined: Sep 24, 2005
Posts: 13
No, it's not a new installation.
Other clients can connect using both tcpip and socket (localhost or 127.0.0.1) so this shouldn't be the problem :-(
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cannot connect to MySQL5 with connector-java