I'm using java/spring to connect to a local mysql database and run some integration tests. Sometimes I get Hibernate errors saying that a connection cannot be established. I've noticed this only happens when WiFi is turned on. If I turn off WiFi, and plug in an ethernet cable, the connection established just fine and all integration tasks pass.
I found sources for this issue regarding PHP, where localhost and 127.0.0.1 are treated differently (one uses TCP, while the other uses the local socket), but none of those solutions helped. I have ensured that IPV6 is disabled and the only parameters in the /etc/hosts file is "127.0.0.1 localhost"
Also, simply running mysql from the command line connects just fine, regardless of whether i use
mysql -u<username> -p -h127.0.0.1 //or
mysql -u<username> -p -hlocalhost
Does anyone have any idea why my WiFi connection is preventing me from connecting to my local DB from spring?