The following query was successful when I used in mysql
INSERT INTO user(`dev_id`,`email`) VALUES('123','[email protected]');
But in java jdbc I got this exception:
Can not issue data manipulation statements with executeQuery().
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
at com.mysql.jdbc.Statement.checkForDml(Statement.java:417)
at com.mysql.jdbc.Statement.executeQuery(Statement.java:1140)
My table have 5 columns and 3 columns have default value =null;
executeQuery is only for issuing query statements. You need to be using executeUpdate for an insert, which is for statements (like INSERT) that modify data. Ideally, you should also be using a PreparedStatement
Instead of executeQuery() try to use execute() or executeUpdate()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With