I have this Tetris game written in Java, which uses DB to record high scores. It worked ok as long as I was using remote MySQL DB, but now I'm trying to set up localhost DB using XAMPP MySQL and it keeps going like "SQLException: Communications link failure" at command:
con = java.sql.DriverManager.getConnection("jdbc:mysql://localhost/score", user, psw);
I guess it's either wrong URL or DB configuration, but I really don't know what to check. Any ideas?
EDIT: My friend has fixed my problem by replacing "localhost" in URL by "127.0.0.1" (which was quite embarrassing as you can surely imagine :P ).
So question is: Why is XAMPP not able to translate "localhost" into IP address and how to fix it?