Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Not a Bug
-
None
-
None
-
MariaDB 10.0.30
Description
private void insertDataInSql(){ |
try { |
Class.forName(dbDriver).newInstance();
|
Connection connection = DriverManager.getConnection(connectString,user,pw);
|
|
String query = "insert into task (description) values (?)"; |
|
PreparedStatement preparedStatement = connection.prepareStatement(query);
|
// preparedStatement.setString(1,this.textFieldName.getText());
|
preparedStatement.setString(1,this.textAreaDescription.getText()); |
preparedStatement.executeUpdate(query);
|
connection.close();
|
System.out.println("Inserted!"); |
} catch (IllegalAccessException e) { |
e.printStackTrace();
|
} catch (InstantiationException e) { |
e.printStackTrace();
|
} catch (SQLException e) { |
e.printStackTrace();
|
} catch (ClassNotFoundException e) { |
e.printStackTrace();
|
}
|
|
The Error: "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '?)' "