MySQL UDF sys_exec

标签 mysql mysql-udf

我正在使用 MySQL UDF 函数 sys_exec 在 MySQL 触发器中调用 Java 程序。您能否提供有关我如何将参数传递给 sys_exec 以便它调用 Java 程序的信息?

最佳答案

您可以使用这个 link to use sys_exec function .它说,

sys_exec sys_exec takes one command string argument and executes it. Syntax

sys_exec(arg1) Parameters and Return Values

arg1 : A command string valid for the current operating system or execution environment. returns An (integer) exit code returned by the executed process. Installation

Place the shared library binary in an appropriate location. Log in to mysql as root or as another user with sufficient privileges, and select any database. Then, create the function using the following DDL statement: CREATE FUNCTION sys_exec RETURNS INT SONAME 'lib_mysqludf_sys.so'; The function will be globally available in all databases. The deinstall the function, run the following statement: DROP FUNCTION sys_exec;

要执行 Java 程序,您应该将 arg1 填写为 "java <absolute path to precompiled program to run>" .

注意:java的路径应该事先配置。

希望对你有帮助

关于MySQL UDF sys_exec,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12460809/

相关文章:

mysql - 使用 zend 连接到 MySQL

MySQL 命令行 - 不要对零值使用自动增量

php - 使用 PDO 对一个请求进行无缓冲查询

mysql - Chef : mysql cookbook does not know root's password after I change it using mysqladmin

mysql - 删除存储在 MySQL 中的文本的额外附加字符

用于处理 json 的 MySQL UDF?

mysql - 将值附加到存储在 MySQL 中的 JSON 解码数组参数

mysql - 当MySQL添加一个与你自己同名的函数时会发生什么?