I have a statement INSERT INTO ... ON DUPLICATE KEY UPDATE ...that executes fine (but with warnings) at the prompt mysql>:
mysql> INSERT INTO ... ON DUPLICATE KEY UPDATE ... ;
Query OK, 2 rows affected, 2 warnings (0.00 sec)
Warning (Code 1364): Field 'x' doesn't have a default value
However, when I try to execute the same statement through JDBC, a warning appears as SQLException, and the lines are not updated:
java.sql.SQLException: Field 'x' doesn't have a default value
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3536)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3468)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1957)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2107)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2086)
at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1365)
Is there a parameter or command to the JDBC or mysql connector to ignore or suppress these warnings?
I am using MySQL Community Server 5.1.31 with the MySQL 5.1.8 connector and Java 1.5.0_24.
source
share