Skip to Main Content

Java and JavaScript in the Database

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Running a Java procedure from an Oracle procedure by defining it as an Oracle procedure

rjsosiSep 8 2021 — edited Sep 8 2021

Hi, we using Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production.
I've loaded the OS_COMMAND package in Oracle and I see it's all java.
The procedure I'm most interested in is the one that allows users to run a Linux command from with in an Oracle procedure. It's defined as the following: ex 1

 procedure set_exec_in_shell
 is language java name 'ExternalCall.useShell()';

How can I define this in an Oracle procedure in order for it to run as an Oracle function?
The only example I have is an Oracle procedure that defines a java method to use as an Oracle function. It's the following: ex 2

CREATE OR REPLACE PROCEDURE SLDPROC.shell (p_command IN VARCHAR2)
AS LANGUAGE JAVA 
NAME 'Host.executeCommand (java.lang.String)';
/

Which comes from the following java method: ex 3

 public class Host {
public static void executeCommand(String command) ...
...

So not having used java for a long time(20 yrs), how can I create a similar Oracle procedure to wrap a java procedure like the set_exec_in_shell procedure defined in the first example, ex 1?

Thanks!

Comments

Answer

Yes. Async, semi-sync, and InnoDB Cluster.

Marked as Answer by 3602098 · Sep 27 2020
Basharat Hussain Oct 16 2024

Dear @dave-stokes-mysql-community-team-oracle

I am facing a problem please Guide me.

I have deployed two MySQL Nodes version 8. I am trying to async MySQL nodes, the replication complete successful as long as a user create or some action performed from the application. When an action is perform from the Application . On the slave node the following error occur.

Before an action perform from the Application everything working fine replication from master to slave working as expected.

Please Guide me.

Thank You in Advance.
Basharat Hussain.

L. Fernigrini Oct 16 2024

You are replying to a 5 year old “solved” thread with a new problem…Please do not hijack existing threads, open a new one with the appropriate details. I'm closing this one.

1 - 3

Post Details

Added on Sep 8 2021
1 comment
687 views