如何从 Oracle Forms 6i 调用 Java 对象/函数?
我正在开发一个遗留项目,该项目使用 Oracle Forms 6i(是的,我知道它很旧)从 PLL 库调用 C++ 函数。
现在我们需要使用 Java 而不是 C++,因此我们需要从 Oracle Forms 调用 Java(对象/类/方法)。
我知道这是一个具有挑战性的主题,但如果有人可以提供一个执行以下操作的简单示例,我会非常高兴:
- 从 Java 类调用方法,传递 int 变量(在 PL/SQL 内)
- 在 Canvas 中打印返回值执行该函数的。
一个基本的例子,也许 Hello World 是理想的。
我了解一些 PL/SQL,但我不是 Oracle Forms 开发人员;请耐心听我说。
如果这是不可能的,你能给我指出一些其他的选择吗?
I am working on a legacy project that is using Oracle Forms 6i (yes, I know its old) to call C++ functions from a PLL library.
Now we need to use Java instead of C++, therefore we need to call Java (Object/Class/Method) from Oracle Forms.
I know its a challenging subject, but I would be really happy if someone could provide a simple example that does the following:
- Invoking a method from the Java class, passing a int variable (within PL/SQL)
- Printing the returned value in the Canvas that executed the Function.
A basic example, perhaps a Hello World would be ideal.
I know some PL/SQL, but I am not a Oracle Forms developer; please bear with me.
If this is not possible, could you point me to some other alternatives?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
好吧,在通过互联网进行深入查找后,我发现了一个非常好的资源(不过是西班牙语):Elias 博客关于Oracle Forms 和 Java
通过这个我成功创建了 hello world 示例:
配置 PATH 环境变量:
Ex: PATH_TO_JAVA = C:\Program Files
添加到 CLASSPATH
创建 Java 程序
将其导出到 Jar 文件(路径必须是您在 CLASSPATH 环境变量中放入的路径。
将类导入到 Forms
在 Oracle Forms 中创建一个新项目,并创建一个画布,在画布中使用文本和按钮。按钮的名称: TEXT_HI_WORLD.
单击菜单:程序 > 导入 Java 类
如果一切正常,则会出现一个新窗口,显示该类所在的包,您可以对其进行扩展,直到导入 HiWorld 类
。程序单元现在将有两个文件:
这是自动生成的文件,需要使用该类
然后返回到画布,右键单击按钮并选择 Thrigger。当按下按钮时,其编程将是:
现在执行程序并单击按钮!
希望这可以帮助对 Forms 没有太多了解的 Java 程序员与遗留系统集成! :D
Well, after an intensive lookup through the internet I came across a very good resource (in Spanish though): Elias blog about Oracle Forms and Java
With this I managed to create the hello world example:
Configure PATH environment variables:
Ex: PATH_TO_JAVA = C:\Program Files
Add to CLASSPATH
Create Java Program
Create with your IDE a simple java program, following is mine:
Export it to Jar file (Path has to be the one you put in CLASSPATH environment variable.
Import the classes to Forms
Create a new project in Oracle Forms and also create a Canvas, in the canvas use a Text and a Button. The name of the button: TEXT_HI_WORLD.
Following click on the Menu: Program > Import Java Classes
If everything went Ok then there will be a new window that will show you the package where the Class is, you extend it until there is the HiWorld class. Import it.
In Program Unit now there will be two files:
This are files generated automatically and needed to use the class.
Then go back to the canvas, right click on the Button and select the Thrigger WHEN-BUTTON-PRESSED, the programming of this will be:
Now execute the program and click on the button! :)
Hope this helps Java programmers with no much of knowledge on Forms to integrate with legacy systems! :D
我之前已经这样做过,并且使用一个简单的类应该可以工作,但是当您尝试开发更复杂的东西时,我建议从 VBean 类扩展,您可以在 oracle 的表单安装文件夹 (frmall.jar) 中找到该库。
I've done this before, and with a simple class this should work, but when you try to develop something more complicated, I recommend extend from the VBean class, you can find the library within oracle's forms installation folders (frmall.jar).