This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Created attachment 163355 [details] A video of the sql statements executing and providing faulty results. I am learning to use SQLite through this website: http://www.sqlitetutorial.net/ although I am using the netbeans database system instead of the standalone command line program they use. According to the website, http://www.sqlitetutorial.net/sqlite-foreign-key/: ---- INSERT INTO suppliers (supplier_name, group_id) VALUES ('HP', 2); This statement works perfectly fine. Third, try to insert a new supplier into the suppliers table with the supplier group that does not exist in the supplier_groups table. INSERT INTO suppliers (supplier_name, group_id) VALUES ('ABC Inc.', 4); SQLite checked the foreign key constraint, rejected the action, and issued an error message: “constraint failed”. ---- Instead of throwing an error message, the statement executed without throwing an error, and entered the bad information into the "suppliers" database. I made a video of what happens, and attached it. The sql statements used to make the video are attached as well. I am using an SQLite jdbc driver, and I assigned it the URL "jdbc:sqlite:" in order to have the database run in memory. I am not sure whether the driver is the problem, or Netbeans, but I thought I would start here.
Created attachment 163356 [details] First set of statements executed in the video.
Created attachment 163357 [details] Second set of statements executed in video
Created attachment 163358 [details] A video of the sql statements executing and providing faulty results.
This is not a netbeans bug. Background: In a "regular" setting the DB and the driver are separated and the DB will take care of interpreting SQL and handling the DB operations. It will also take care to offer the "right" DB semantics (ACID for example). In this case though you use a JDBC driver to access an sqlite file and don't deal with sqlite (at least most probable). The driver in this case needs to simulate the sqlite behavior and it looks as if referential constraints are not simulated. Foreign keys seem to be an optional component (see section 2 of the following document): https://www.sqlite.org/foreignkeys.html So if you want to learn about DBs and full SQL I suggest to use another DB: derby/javadb and h2 are two in the java ecosystem.