Quantcast
Channel: MySQL Forums - Connector/J, JDBC and Java
Viewing all articles
Browse latest Browse all 884

Set foreign key column with default value to null (1 reply)

$
0
0
I have a table with a column defined like

refId INTEGER NOT NULL DEFAUlT 0

If I try to set it to null using a "database tool" (in this case Sequel Pro 1.1.2), by issuing

update mytable set refId = null;

it works fine, and the column gets set to the default value of 0. However, if I try to issue exactly the same update via the JDBC driver from Java, I get

java.sql.SQLIntegrityConstraintViolationException: Column 'refId' cannot be null

This seems very strange to, not sure if it's a bug?

Viewing all articles
Browse latest Browse all 884

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>