[英]SQLite foreign key constraints
I am using Java with SQLiteJDBC . 我将Java与SQLiteJDBC结合使用 。
I was struggling to understand why my foreign keys were not acting as constraints, until I read the following: 在阅读以下内容之前,我一直在努力理解为什么我的外键没有充当约束:
Prior to version 3.6.19, SQLite did not support foreign key constraints. 在3.6.19版之前,SQLite不支持外键约束。
I then took a closer look at the SQLiteJDBC website and found: 然后,我仔细查看了SQLiteJDBC网站,发现:
The current version is v056, based on SQLite 3.6.14.2. 当前版本是基于SQLite 3.6.14.2的v056。
There is a solution documented here , although it is a very old article - is it still the best way to proceed? 尽管这是一篇非常古老的文章,但这里记录了一个解决方案-仍然是进行下一步的最佳方法吗? Would other SQLite Java connectors be recommended? 是否建议使用其他SQLite Java连接器?
SQLite support in Java seems to not be so great . Java中对SQLite的支持似乎不是那么好 。
You may be able to rebuild javasqlite against a newer version of SQLite, since it depends on: 您可以针对较新版本的SQLite重建javasqlite ,因为它取决于:
SQLite 2.4.12 or higher SQLite 2.4.12 或更高版本
Whether it will actually work remains to be seen, but I think SQLite has a fairly stable API. 它是否真的有效还有待观察,但我认为SQLite具有相当稳定的API。
You could also try to build SQLiteJDBC from source against a newer version of SQLite. 您也可以尝试针对较新版本的SQLite 从源代码构建SQLiteJDBC。
EDIT: 编辑:
Actually, Xerial SQLiteJDBC has been updated much more recently . 实际上, Xerial SQLiteJDBC已更新得多 。 Apparently it's a lot slower though since it's pure Java. 显然,由于它是纯Java,它的速度要慢得多。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.