Derby 和 DB2 之间的可移植模式
我想使用 Derby 作为给定 DB2 数据库的子集,该数据库旨在在大型机中运行。
在设计数据库时,您会给出哪些提示和技巧,以便最多(至少是 DML)介于两个数据库之间?
I'd like to use Derby as a Subset for a given DB2 Database which is meant to run in a Mainframe.
Which tips and tricks would you give when designing the database in order to be at most (at least DML) between the two databases?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我猜你的问题中“最多”的意思是“最兼容”?
总的来说,我认为你在德比郡做出了正确的选择。这是我所知道的唯一一个像 DB2 一样强制执行强类型的数据库。我想 Derby 版本的
dual
表被称为SYSIBM.SYSDUMMY1
并非巧合。避免 DML 不兼容问题的最佳方法是在应用程序中使用数据库抽象方法。如果您使用 Java,则 Hibernate 或 jOOQ提供了这样的选项。如果抽象数据库不适合您,那么我建议您在自动化集成测试中编写大量示例查询。然后,您将针对 Derby 和 DB2 运行该测试,以检查行为是否相同(例如,插入记录、使用 JOIN、嵌套 SELECT 等再次读取记录)。
作为 jOOQ 的开发人员,我可以告诉您,自己编写集成测试将非常棘手,特别是对于 Derby 和DB2! :-)
I'm guessing that by "at most" you meant "most compatible" in your question?
In general, I think you made the right choice with Derby. It is the only database I know of, that enforces such strong typing as DB2 does. I guess it's not a coincidence that the Derby's version of the
dual
table is calledSYSIBM.SYSDUMMY1
.The best way to avoid DML incompatibility problems is by using a means of database abstraction in your application. If you are using Java, then Hibernate or jOOQ provide such options. If abstracting your database is not an option for you, then I recommend you write a big set of example queries in an automated integration test. That test, you will then run against both Derby and DB2, to check that the behaviour will be identical (e.g. insert records, read them again using JOINs, nested SELECTS, etc, etc).
As the developer of jOOQ, I can tell you that writing the integration tests yourself will be quite tricky, especially for Derby and DB2! :-)