Search code examples
jackcessucanaccess

How disable check constraint on connection


java.sql.DriverManager.getConnection("jdbc:ucanaccess:///user/dev/project/project.mdb")

I have this error

Java::NetUcanaccessJdbc::UcanaccessSQLException: integrity constraint violation: NOT NULL check constraint; SYS_CT_10991 table: EMPLOYE column: DATE

I doesn't want control integrity at the connection, what is the property parameter to disable check contrainte at the connection ?

Thank for your help


Solution

  • If this exception is thrown at the connection time, it means that the database data are inconsistent with its contraints: ucanaccess is properly building a dbms layer with all integrity contraints but the creation of one of those constraints fails.

    You can't disable it, ucanaccess must create all constraints so that when you try to insert/update/delete a record, all related constraints are checked and your db consistent state is preserved.

    Why don't you drop the not null constraint in the database table definition?(you have just to set the "required" property, on the mentioned column, from true to false). It doesn't seem to be taken into account...