I have this Tetris game written in Java that uses a database to record high results. It worked fine while I used the remote MySQL DB, but now I'm trying to configure localhost DB using XAMPP MySQL, and it continues to work as "SQLException: Network Communication Error" with the command:
con = java.sql.DriverManager.getConnection("jdbc:mysql://localhost/score", user, psw);
I assume this is the wrong URL or DB configuration, but I really don't know what to check. Any ideas?
EDIT: my friend fixed my problem by replacing "localhost" in the URL with "127.0.0.1" (which was pretty awkward, as you might imagine: P).
So the question is: Why cannot XAMPP translate "localhost" into an IP address and how to fix it?
java mysql jdbc xampp
Jakub stejskal
source share