简体   繁体   English

Oracle在另一台机器上调用Java方法

[英]Oracle call to Java method on another machine

I am not allowed to compile the java class into the instance of Oracle we're running on, per architects request, so I am looking for alternatives. 根据架构师的要求,我不允许将java类编译到我们正在运行的Oracle实例中,因此我正在寻找替代方案。 The requirement is to utilize a java library located on an application server on the network. 要求是利用位于网络上的应用程序服务器上的Java库。 Is it possible to call a java method located on another machine from PL/SQL? 是否可以从PL / SQL调用位于另一台机器上的java方法? I found this article talking about external procedures in Oracle, but I'm not sure that it allows for this. 我发现这篇文章讨论了Oracle中的外部过程,但我不确定它是否允许这样做。 As a side not, the performance would also have to be fast enough to be used in batch processing of thousands or millions of calls. 另一方面,性能还必须足够快,以便用于数千或数百万次呼叫的批处理。

I suspect the best you can do is add entries to another table which your Java process polls to get each or batches of messages. 我怀疑你能做的最好的事情是将条目添加到另一个表中,你的Java进程轮询它以获取每个或多批消息。 Oracle is not really designed for message processing. Oracle并不是真正用于消息处理的。

In any case, I would discuss this with your Architect what to do as he is the expert. 无论如何,我会和你的建筑师讨论这个问题,因为他是专家。 ;) ;)

If your Oracle system can't do the job, you may need to have a solution which doesn't use Oracle. 如果您的Oracle系统无法完成这项工作,您可能需要一个不使用Oracle的解决方案。

You have three options: 你有三个选择:

1.) We solved a similar problem by making PL/SQL call HTTP using UTL_HTTP and then let the app-server call the java procedure. 1.)我们通过使用UTL_HTTP使PL / SQL调用HTTP然后让app-server调用java过程来解决类似的问题。 We did this to interface our Oracle Database with Oracle Reports. 我们这样做是为了将我们的Oracle数据库与Oracle Reports连接起来。 The PL/SQL fired an HTTP Request which was received by the app-server which called Java. PL / SQL触发了一个HTTP请求,该请求由app-server接收,称为Java。 The Java can call back PL/SQL via normal JDBC. Java可以通过普通的JDBC回调PL / SQL。

2.) You might not be able to load that java proc, but maybe you can create some other java stored procedure that can invoke it using RMI. 2.)您可能无法加载该java proc,但也许您可以创建一些可以使用RMI调用它的其他Java存储过程。

3.) AQ is another method. 3.)AQ是另一种方法。 Basically you can Queue a message using AQ and use JMS on the App Server to Dequeue it and use it. 基本上,您可以使用AQ对消息进行排队,并在App Server上使用JMS对其进行出列并使用它。

Option 3 would be the fastest, though we have tried option 1 and the latency for this is not as much as you might it. 选项3将是最快的,尽管我们已经尝试了选项1,并且延迟时间并不像您那样多。 It also offers a way to do some parallel processing by running multiple requests in parallel. 它还提供了一种通过并行运行多个请求来进行并行处理的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM