danke für die hilfe
jetzt sieht meine methode so aus:
public static void InMySQL(String[][] args, String unischrift){
try{
Class.forName("com.mysql.jdbc.Driver");
}
catch (ClassNotFoundException e){
System.out.println("Kann nicht geladen werden");
return;
}
try{
Connection con=
DriverManager.getConnection(
"jdbc:mysql://localhost/customer","root","hallo100");
Statement stmt=(Statement) con.createStatement();
String bef;
/*String autor="Kant";
String titel="Kritik der reinen Vernunft";
int jahr=1965;*/
bef="insert into " + unischrift
+"(CustomID, Bisheriger Nutzen , Zeitraum) "
+"values (\""+args[0][0]+"\", \""+args[0][1]+"\", \""+args[0][2]+"\")";
//System.out.println(bef);
boolean rs=stmt.execute(bef);
// rs.close();
stmt.close();
con.close();
}
catch (SQLException se){
System.out.println("SQL Fehler "+se.getMessage());
se.printStackTrace(System.out);
}
}
und es kommt zu folgener fehler meldung:
SQL Fehler You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'nutzen(CustomID, Bisheriger Nutzen , Zeitraum) values ("2132153359100255838", "1' at line 1
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'nutzen(CustomID, Bisheriger Nutzen , Zeitraum) values ("2132153359100255838", "1' at line 1
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.Util.getInstance(Util.java:386)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1053)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4096)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4028)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2490)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2651)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2728)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2678)
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:894)
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:732)
at GUI.Main.InMySQL(Main.java:69)
at GUI.Main.main(Main.java:39)
wenn ich das richtig interpretiere, erkennt er sie spalte für bisherigen nutzen nicht?