I’ve just been setting up Eclipse for Stripes development on my home PC and hit a problem connecting to the database. I haven’t seen this on any of my Windows XP machines and it seems to be specific to Windows Vista, which was bundled with the PC.
Versions in use are:
- Windows Vista Home Basic
- MySQL Server Community Edition 5.1.37
- Eclipse JEE Galileo (based on Eclipse 3.5)
- JDK 1.6 Update 16
- JARs: mysql-connector-java-5.1.6-bin.jar, ibatis-184.108.40.2067.jar
I tried re-installing MySQL with User Account Control turned off, and verified that it wasn’t being blocked by the firewall. Still no joy.
Then I found this thread on CodeRanch which suggests that the problem is something to do with resolving localhost. So I checked c:/windows/system32/drivers/etc/hosts and found this:
It isn’t clear why the standard loopback IP address isn’t included, but adding it back in fixes the problem (also see Microsoft KB article):
127.0.0.1 localhost ::1 localhost