Code:java public void executeQuery(){ Connection conn; String url = "jdbc:mysql://192.168.1.107:3306/players"; try{ conn = DriverManager.getConnection(url, "Test", "Password"); PreparedStatement statement = conn.prepareStatement("INSERT INTO name (name) VALUES ('Test')"); statement.executeQuery(); } catch(Exception e){ System.out.println("Error connecting to MySql Server."); } } This method is called every time a player joins. But when it is called, it shows : "Error connecting to MySql Server." . I do have the SQL configured correctly but I still get the error. Can anyone please guide me on what I could be doing wrong?
I belive tha username and password are case sensitive, and I'm not sure if this is the right order of arguments. (ok it is, I dont know how to fix it either lol)
Geeky121 Are you sure your sql server is reachable from another computer than localhost? Or does the sql server run at localhost?
Geeky121 Maybe try using the localhost address instead of your internal ip? Code:java jdbc:mysql://localhost:3306/players If you use your internal ip I think it connects differently, then it could get caught in the firewall or something like that.
I got it working! The problem was this line: Code:java executeQuery() To: Code:java executeUpdate() Thanks for the help though!