This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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]
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!
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?
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.