如何从MySQL调用Java代码? [英] How to Call Java Code from MySQL?
问题描述
我在2008年发现了一篇文章,讨论如何从MySQL调用Java代码。有很多警告和免责声明,因为这个过程涉及使用MySQL的实验分支。
I found an article from 2008 discussing how to call Java code from MySQL. There were a lot of caveats and disclaimers because the process involved working with an experimental branch of MySQL.
对于我想到的项目,它是非常有用的能够访问MySQL中的Java库,类似于Oracle的 Java存储过程一>。此功能现在是否作为MySQL的标准功能存在?如果没有,哪些开源RDBMS支持类似于Oracle的Java存储过程?
For a project I have in mind, it would be very useful to be be able to access Java libraries within MySQL, analogous to Oracle's Java Stored Procedures. Does this capability now exist as a standard feature of MySQL? If not, what open source RDBMSs support something similar to Oracle's Java Stored Procedures?
推荐答案
PostgreSQL支持可插入的过程语言和项目存在以使用 PL / Java 作为语言来扩展PostgreSQL。
PostgreSQL supports pluggable procedure languages, and a project exists to extend PostgreSQL with PL/Java as the language.
我不建议在RDBMS中放入太多代码。在应用程序层中开发,测试和调试代码的工具比在RDBMS中使用代码的工具更好。
I don't recommend putting too much code in the RDBMS. Tools to develop, test, and debug code in the application layer are better than tools for code in the RDBMS.
此外,许多开发人员并不了解RDBMS中的代码应遵循事务隔离。他们尝试从触发器等发送电子邮件。我认为副作用的代码应该在应用程序层中,因此您不会创建幻像效果(例如,即使更改已回滚,电子邮件也可能会通知数据库更改。)
Also many developers don't understand that code inside the RDBMS should obey transaction isolation. They try to send emails from triggers and so forth. I think code with side effects should be in the application layer, so you don't create phantom effects (e.g. an email may notify of a database change, even though the change was rolled back).
这篇关于如何从MySQL调用Java代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!