my dog learned polymorphism*
The moose likes JDBC and the fly likes Communications link failure with MySQL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Communications link failure with MySQL" Watch "Communications link failure with MySQL" New topic
Author

Communications link failure with MySQL

Mike Clarkson
Greenhorn

Joined: Dec 31, 2009
Posts: 4
i'm trying to create a java application [it's been a while since i have], and i'm trying to connect to mysql with the latest connector/J [5.1.10] and on my windows 7 machine i get the following error. but on my ubuntu laptop, it works just fine

the code i'm running is this:


on my windows machine, the error is as follows:


as i stated before, it works fine on my ubuntu machine, my debian box running mysql accepts remote connections. the only issue is trying to run from my windows 7 machine [uac turned off, eclipse run as administrator]

any help would be greatly appreciated
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3817

If same code runs on another distribution, then there might be something with the Windows 7 (may be it blocks those incoming packets).Have you tried disabling firewall etc..?


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3817

And Welcome to JavaRanch, Mike

Happy & Prosperous New Year to all the Ranchers
Mike Clarkson
Greenhorn

Joined: Dec 31, 2009
Posts: 4
my windows firewall is turned off, and when i tried to telnet to my debian machine [where mysql is] on port 3306, putty just exits with no notice. i'm wondering if it's my router that is blocking traffic, but why blocking on the windows side and not the linux side [as my laptop runs ubuntu and can connect just fine]? if it's not my router, what in windows could be blocking the connection? i have no other software firewall running, and i've even disabled my antivirus just in case. this is really confusing...

and thanks for the welcome and the new years wishes, same to you!
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9956
    
163

Just a guess - Usually, that exception is a result of incorrect JDBC driver jar being used for the version of the MySQL server. Are you sure the MySQL server on your Windows system is the same as the one on Ubuntu and the driver jar you are using on Windows is the right one?

[My Blog] [JavaRanch Journal]
Mike Clarkson
Greenhorn

Joined: Dec 31, 2009
Posts: 4
i don't have a mysql server on my windows machine or on my ubuntu machine. it's only installed on my debian machine. ubuntu can connect to mysql just fine, windows can not for some reason.

Versions:
mysql: 5.0.51a [standard from the debian lenny repos]
connector/j: 5.1.10
java: 1.6.0.14 [on windows] and 1.6.0.15 on my ubuntu machine

i wonder if that minor revision of java is the problem...

thanks for the suggestions!
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

From the Windows machine, try running this and see what you get:

telnet 192.168.1.150 3306

You should get some garbage characters back. (You can close the connection using CTRL-Z)

If that works, try installing the MySQL GUI tools on your windows box and connect to the database using them. You will probably have to add your Windows IP address as an allowed root host in MySQL.

Finally, look at the the hosts file on the Windows machine, and on the Debian machine. An invalid hosts file can cause strange communications problems like what you are seeing. You can post the hosts files if the error is not obvious.

One more thought - try turning off IPv6 in Windows 7 - it is on by default.


JBoss In Action
Mike Clarkson
Greenhorn

Joined: Dec 31, 2009
Posts: 4
it works now, for some reason denyhosts had my internal ip for my windows machine blocked. i removed it and all is working.

thanks for all the help! this community seems pretty awesome so far!

mike
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Communications link failure with MySQL
 
Similar Threads
Problem connecting eclipse to mysql database with hibernate
applet socketpermissions
applet Mysql connection
mysql connection problem
Error connecting on MySQL