HeadiPlays
Redstoneengineer
Hallöle 
Ich möchte beim onEnable() {...
eine Datenbank erstellen, falls sie nicht existiert.
Ich habe den MySQL befehl bereits in der SQL ausprobiert, und dort hat er
reibungslos funktioniert..
Hier der CODE:
Hier die Fehlermeldung:
Und hier meine MySQL klasse:
Ich hoffe, ihr könnt mir helfen
Ich möchte beim onEnable() {...
eine Datenbank erstellen, falls sie nicht existiert.
Ich habe den MySQL befehl bereits in der SQL ausprobiert, und dort hat er
reibungslos funktioniert..
Hier der CODE:
Code:
MySQL.Update("CREATE TABLE IF NOT EXISTS general (id int(5), kills int(5), deaths int(5), name varchar(16))");
Hier die Fehlermeldung:
Code:
[18:36:23 WARN]: java.sql.SQLException: Can not issue data manipulation statements with executeQuery().
Und hier meine MySQL klasse:
Code:
public class MySQL {
public static String user ="root";
public static String pass = "ichbrauchehilfe";
public static String host = "localhost";
public static String db = "bowgame";
public static Connection con;
public static void connect() {
try {
con = DriverManager.getConnection("jdbc:mysql://" + host + ":3306/" + db, user, pass);
System.out.println("[MySQL] Sucessfully connected!");
}catch (SQLException e) {
System.err.println(e);
}
}
public static void close() {
try {
if(con != null) {
con.close();
}
} catch (SQLException e) {
System.err.println(e);
}
}
public static void Update(String qry) {
try {
Statement st = (Statement) con.createStatement();
st.executeQuery(qry);
} catch (SQLException e) {
System.err.println(e);
}
}
public static ResultSet Query(String qry) {
ResultSet rs = null;
try {
Statement st = (Statement) con.createStatement();
st.executeQuery(qry);
} catch (SQLException e) {
System.err.println(e);
}
return rs;
}
}
Ich hoffe, ihr könnt mir helfen