Calling java function load an store in database

Hi ,
I try to call a java fonction loaded and published in database (Oracle 8.1.7.4ee). this function call an OS command ... the PL/SQL call is completed but de command set in parameters function is not execute ... next is the code :
import java.lang.*;
import java.io.*;
public class JShell {
public static void execute (String command) throws IOException {
try {
Process child = Runtime.getRuntime().exec(command);
} catch (IOException e) {
calling this function with java main is OK
import java.lang.*;
import java.io.*;
public class TestJShell {
static public void main(String args[]) throws Exception
JShell.execute(args[0].toString());
java TestJShell 'cp /test/myfile.txt /test/myfile.sav'
copy is donethen when the fuction is loaded and published in database
as
loadjava -user ../.. JShell.class
CREATE OR REPLACE PROCEDURE JShell_exe (Commande in VARCHAR2) AS LANGUAGE JAVA NAME 'JShell.execute(java.lang.String)';run is
CALL ell_exe ('cp /test/myfile.txt /test/myfile.sav');
call is completed but no copy is donethank's for your help

you might need some more privileges to interact with the system from inside oracle.
I don't know what those are but I had to give privs to a user to open a socket from java.
exec dbms_java.grant_permission( 'MIS_ADMIN', 'SYS:java.net.SocketPermission', 'localhost', 'resolve' ) ;
This allowed the jsp to use localhost. You might need to find a similar permission to grant.

Similar Messages

  • Calling java function load and stored in database

    Hi ,
    I try to call a java fonction loaded and published in database (Oracle 8.1.7.4ee). this function call an OS command ... the PL/SQL call is completed but de command set in parameters function is not execute ... next is the code :
    import java.lang.*;
    import java.io.*;
    public class JShell {
    public static void execute (String command) throws IOException {
    try {
    Process child = Runtime.getRuntime().exec(command);
    } catch (IOException e) {
    calling this function with java main is OK
    import java.lang.*;
    import java.io.*;
    public class TestJShell {
    static public void main(String args[]) throws Exception
    JShell.execute(args[0].toString());
    java TestJShell 'cp /test/myfile.txt /test/myfile.sav'
    copy is donethen when the fuction is loaded and published in database
    as
    loadjava -user ../.. JShell.class
    CREATE OR REPLACE PROCEDURE JShell_exe (Commande in VARCHAR2) AS LANGUAGE JAVA NAME 'JShell.execute(java.lang.String)';run is
    CALL ell_exe ('cp /test/myfile.txt /test/myfile.sav');
    call is completed but no copy is doneCan somebody help me ? thanking you in anticipation;

    Firs things first:
    1)Which copy of your class is loaded in the DB ( it seems that you have two different classes JShell and TestJShell ).
    2)Do you have permisions for file manipulation ?
    3)Do you get any errors ?

  • How to call java function from PL/sql in oracle applications

    I am trying to call a java function from plsql procedure. Can any one explain how to call java function, and in which directory I have to store my java function in oracle applications. Do I need to register that java function from Application developer.
    Thanks
    Kranthi

    http://www.oracle.com/technology/tech/java/jsp/index.html
    Good Luck,
    Avi.

  • Calling Java function thru PL-SQL

    Dear all
    As i am New to JAVA ,Can you plz Tell how we can call Java function thru PL-SQL?
    To activate / deactivate function will be called from the database plug-ins. No need for GUI.
    Using the URL ,The objective is to automate this function.
    Many Thanks
    Edited by: khaja on Jan 18, 2009 12:50 PM

    Khaja,
    Please refer to http://download.oracle.com/docs/cd/B19306_01/java.102/b14187/chthree.htm#CACICFFB
    Please try to avoid asking questions for which you can easily find the answer yourself.
    I had to look this up, and found it in less than 2 minutes.
    Sybrand Bakker
    Senior Oracle DBA

  • ABAP Calling JAVA Function or Method

    Hi Friend,
    I need help in how to proceed using  ABAP  and Call JAVA Function . I know that  we need to use RFC enabled Function modules. I was able to connect  using JAVA Connector which was provided by SAP For communicating with JAVA Apps. The approach for connecting the JAVA to SAP is working fine.  But I  have browsed through various website but failed to find any information.Now i am looking forward to help from you friends to solve my problems .
    The Requirement is mentioned below:-
      1. Prerequiste for SAP ABAP calling a third Party software which is working in JAVA Platform (like any middle ware which might be hardware or software).
      2. Sample Code  like calling a Text  ' Hello  to the world  calling JAVA from ABAP'.
      3. Steps and process so that it would be helpful.
    Timely help would be appreciated.
    Rajiv Christopher.

    1.Middleware is JCO RFC provider it comes with SAP so no need any third party Adapter.
    2.
    " The ECHOTXT parameter should contain the text of REQUTXT.Information on
    " calling the function module should be returned in RESPTXT, indicating, for
    " example, in which system and when the function module call was processed.
    data:ECHOTEXT type SY-LISEL,
         RESPTEXT type SY-LISEL.
    CALL FUNCTION 'STFC_CONNECTION' DESTINATION '<Your JCO destination name>' " which one you have developed in SM59 as TCP/IP
      EXPORTING
        requtext       = 'ABAP Calls JAVA'
    IMPORTING
       ECHOTEXT       = ECHOTEXT
       RESPTEXT       = RESPTEXT.
    if sy-subrc = 0.
      WRITE:/'---------------------------------------------------------------------'.
      WRITE: / 'establish a link to the ABAP application server with logon data'.
      WRITE:/'---------------------------------------------------------------------'.
      write:/ ECHOTEXT .
      else.
          WRITE:/'---------------------------------------------------------------------'.
      WRITE: / 'Not establish a link to the ABAP application server with logon data'.
      WRITE:/'---------------------------------------------------------------------'.
      endif.
    Check the sample code and Let me know will you get ECHOTEXT ?
    Kanagaraja L
    Edited by: Kanagaraja  Lokanathan on Jan 6, 2010 1:27 PM

  • Call Java functions in a C DLL

    Hi,
    I am develop a dynamic link library in C on AIX that will internally call java functions using JNI. This libaray will be finally used by other C Executable.
    There is only one function in C code i.e. Connect. This function internally use JNI and call java functions. Now while compiling I am facing problems. I think that there is some problem with my makefile.
    The make file is given hereunder:
    JAVA_HOME = /usr/java14
    JAVA_INC = $(JAVA_HOME)/include
    CC = cc
    LD = cc
    # Flags to create a dynamic library.
    DYNLINKFLAGS =  -G -ostdlib -bnoentry -bM:SRE -brtl -bE:Interface.exp
    # files removal
    RM = rm -f
    #------------------------------------- Libs -----------------------------------#
    JAVALIBS      = -L$(JAVA_HOME)/jre/bin/classic/
    LIBS            = -ljvm -lpthread  -lxnet -lnsl -lm -ldl
    #-------------------------------- Dependency rules---------------------------#
    # shared library files
    LIB_FILES = Interface.a
    #-------------------------------------OBJs-------------------------------------#
    # shared libraries object files
    LIB_OBJS    = Interface.o
    all: $(LIB_FILES)
    # create our librarys
    Interface.a: Interface.o
         $(LD) $(DYNLINKFLAGS) $(JAVALIBS) $(LIBS) $(LIB_OBJS) -o $@
    # compile C source files into object files.
    %.o: %.c
         $(CC) $(DYNLINKFLAGS) -L$(JAVA_INC) -c $<
    # clean everything
    clean:
         $(RM) $(LIB_OBJS) $(LIB_FILES)
    # clean the library's object files only
    cleanlibobjs:
         $(RM) $(LIB_OBJS)Now the problem is that the size of the Interface.a file is very small only 552 bytes. whereas the size of Interface.o file is 34428. Which clearly indicates that the problem is with the Interface.a file i.e during linking.
    Can any body help me to figure out the problem.
    Regards,
    Ahmad Jalil Qarshi

    I guess, you are better off to ask this question in a C forum. This is a Java forum, you know.

  • Call Java function from multithreaded VC++ application

    Friends, I want to call Java function from two threads of a single VC++ application. I can call it from single thread but when I call it from another thread also, JNI_CreateJavaVM() replies with an error.
    Please......help me

    Your posting is ambiguous. My impression is that you have two threads, both trying to create a java VM?

  • How to call java function in javascript

    Hello Everyone,
    Can anyone tell me solution that:
    How to call java function in javascript?
    Thanks,
    VIDs

    You can't since Java is running on the server and javascript is running in the browser long after the Java side of things has finished executing. Assuming you're not talking about an applet here.
    But you can make calls back to the server through Ajax. All you need is something like a servlet on the receiving end which you can invoke through Ajax; from that point you can execute any Java code you want.

  • How to call java function with parameter from javascript in adf mobile?

    how to call java function with parameter from javascript in adf mobile?

    The ADF Mobile Container Utilities API may be used from JavaScript or Java.
    Application Container APIs - 11g Release 2 (11.1.2.4.0)

  • Calling java functions from c++

    I want to start my program from visual c++ then, call java functions and then calling c++ function. How can i do this?

    Yet another cross-poster: [Calling java functions from c++|http://www.java-forums.org/new-java/12597-calling-java-functions-c.html]

  • Problem while calling java function from html

    when i tried to call a java function from html i'm getting an error
    object don't support this property.
    what could be the reason.
    This is my html.
    I got this from this forum only.
    My applet is accessing the system property "user.home".
    I ran it in IE
    <DIV id="dvObjectHolder">Applet comes here</DIV>
    <br><br>
    <script>
    if(window.navigator.appName.toLowerCase().indexOf("netscape")!=-1){ // set object for Netscape:
         document.getElementById('dvObjectHolder').innerHTML = " <object ID='appletTest1' classid=\"java:test.class\"" +
    "height=\"0\" width=\"0\" onError=\"changeObject();\"" +
              ">" +
    "<param name=\"mayscript\" value=\"Y\">" +
    "<param name=\"archive\" value=\"sTest.jar\">" +
    "</object>";
    }else if(window.navigator.appName.toLowerCase().indexOf('internet explorer')!=-1){ //set object for IE
         document.getElementById('dvObjectHolder').innerHTML = "<object ID='appletTest1' classid=\"clsid:8AD9C840-044E-11D1-B3E9-00805F499D93\"" +
              " height=\"0\" width=\"0\" >" +
              " <param name=\"code\" value=\"test.class\" />" +
         "<param name=\"archive\" value=\"sTest.jar\">" +
              " </object>"
    </script>
    <LABEL id="lblOutputText">This text will be replaced by the applet</LABEL>
    <BR>
    <input value="Javascript to java" type=button onClick="document.appletTest1.fromJavaScript()">

    I tried this example using the repy given to an earlier post.
    But its not working with me.
    What i did in addition was adding plugin.jar to classpath to import netscape.javascript.*;
    Let me add some more details
    1) I'll add the stack trace
    2) my java progrma
    3) batch file to sign the applet.
    1) This is the stack trace i don't know whether u will undertand this
    load: class test.class not found.
    java.lang.ClassNotFoundException: test.class
         at sun.applet.AppletClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadCode(Unknown Source)
         at sun.applet.AppletPanel.createApplet(Unknown Source)
         at sun.plugin.AppletViewer.createApplet(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Caused by: java.io.FileNotFoundException: C:\FastranJava\AppletObject\bin\test\class.class (The system cannot find the path specified)
         at java.io.FileInputStream.open(Native Method)
         at java.io.FileInputStream.<init>(Unknown Source)
         at java.io.FileInputStream.<init>(Unknown Source)
         at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
         at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
         at sun.applet.AppletClassLoader.getBytes(Unknown Source)
         at sun.applet.AppletClassLoader.access$100(Unknown Source)
         at sun.applet.AppletClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         ... 10 more
    Exception in thread "Thread-5" java.lang.NullPointerException
         at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
         at sun.plugin.AppletViewer.showAppletException(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    2) Java Program
    import netscape.javascript.*;
    import java.applet.*;
    public class test extends Applet
         private JSObject win;
         private JSObject outputLabel;
         private boolean buttonFromJavaClicked=false;
         checkJavaScriptEvent evt=new checkJavaScriptEvent();
         public void init()
              try
                   evt.start();
                   win=JSObject.getWindow(this);
                   outputLabel=(JSObject)win.eval("document.getElementById('lblOutputText')");
                   outputLabel.setMember("innerHTML", "<center><h1>From Init<br>Your Home directory" + System.getProperty("user.home") + "</h1></center>");
              catch(Exception e)
                   e.printStackTrace();
         public void fromJavaScript()
              buttonFromJavaClicked=true;          
         public void fromJavaScript2()
              System.out.println("Started Form JavaScript2");
              try
                   String strLbl="<center><h1>From JavaScript<br>Your Homedir:" + System.getProperty("user.home") + "</h1></center>";
                   outputLabel.setMember("innerHTML", strLbl);
              catch(Exception e)
                   e.printStackTrace();
         class checkJavaScriptEvent extends Thread
              public void run()
                   while(true)
                        if(test.this.buttonFromJavaClicked)
                             System.out.println("OK buttonfromjava is true");
                             test.this.buttonFromJavaClicked=false;
                             fromJavaScript2();
                        try
                             Thread.sleep(3000);
                        catch(Exception e)
                             e.printStackTrace();
    3) Batch file
    del *.cer
    del *.com
    del *.jar
    del *.class
    javac -classpath ".;C:\Program Files\Java\jre1.5.0_06\lib\plugin.jar" test.java
    keytool -genkey -keystore harm.com -keyalg rsa -dname "CN=Harm Meijer, OU=Technology, O=org, L=Amsterdam, ST=, C=NL" -alias harm -validity 3600 -keypass password -storepass password
    jar cf0 test.jar *.class
    jarsigner -keystore harm.com -storepass password -keypass password -signedjar sTest.jar test.jar harm
    del *.class

  • Calling JAVA Functions from XSLT

    Hi,
    I am trying to invoke a Java Extension Function from a XSLT. I added both the class file and the XSLT file to a folder, then zipped the entire folder and uploaded into the Archive for my Interface MApping.
    The CLASS gets loaded but the runtime engine gives an error when calling the JAVA Function.
    Here is what it says:
    Creating mapping sequence with 2 steps. --- Creating Java mapping Deliveries/stringHandler --- Creating mapping sequence with 2 steps. --- Creating XSLT mapping Deliveries/test1 --- Using MappingResolver with context URL /sapmnt/XD1/global/xi/mapping/http%3A%2F%2Fwolterskluwer%2Ecom%2Fxi%2F wk_midas_deliveries%2Ftest/cd2e6820267511d9cb52c3c5143c3524/ --- Loaded class Deliveries.stringHandler --- com.sap.aii.ibrun.server.map.MappingRuntimeException: at com.sap.aii.ibrun.server.map.MappingRuntimeException.code_STYLESHEET_OR_CLASS_NOT_FOUND(MappingRuntimeException.java:91) at com.sap.aii.ibrun.server.map.RUMappingJava.instantiate(RUMappingJava.java:168) at com.sap.aii.ibrun.server.map.RUMappingJava.execute(RUMappingJava.java:41) at com.sap.aii.ibrun.server.map.RUSequence.execute(RUSequence.java:50) at com.sap.aii.ibrun.server.map.RURunner.run(RURunner.java:58) at com.sap.aii.ibrun.server.map.RUManager.run(RUManager.java:66) at com.sap.aii.ibrun.sbeans.map.MappingRequestHandler.handleRequest(MappingRequestHandler.java:67) at com.sap.aii.ibrun.sbeans.map.MappingServiceImpl.processFunction(MappingServiceImpl.java:83) at com.sap.aii.ibrun.sbeans.map.XMappingServiceObjectImpl0.processFunction(XMappingServiceObjectImpl0.java:24) at com.sap.aii.ibrun.sbeans.map.MappingServiceKey.processFunction(MappingServiceKey.java:10) at java.lang.reflect.Method.invoke(Native Method) at com.inqmy.services.rfcengine.RFCDefaultRequestHandler.invokeBean(RFCDefaultRequestHandler.java:83) at com.inqmy.services.rfcengine.RFCDefaultRequestHandler.handleRequest(RFCDefaultRequestHandler.java:50) at com.inqmy.services.rfcengine.RFCJCOServer.handleRequest(RFCJCOServer.java:69) at com.sap.mw.jco.JCO$Server.dispatchRequest(Unknown Source) at com.sap.mw.jco.rfc.MiddlewareRFC$Server.nativeListen(Native Method) at com.sap.mw.jco.rfc.MiddlewareRFC$Server.listen(Unknown Source) at com.sap.mw.jco.JCO$Server.listen(Unknown Source) at com.sap.mw.jco.JCO$Server.run(Unknown Source) at java.lang.Thread.run(Thread.java:513) --
    Any help or suggestions to solve this problem would be greatly appreciated.
    Thanks
    A

    Hi,
    Thanks for looking into this.
    1. I have verified that the path in the zip file is correct i.e com/sap/test/stringHandler.class
    2. test1.xsl is in the root folder i.e No path.
    3. I see the Message in the stacktrace saying "Loaded Class com/sap/test/stringHandler.class " but after that I get a runtime MApping Error and it says "CLASS_NOT_FOUND".
    Can you please tell me why is this happening?
    Thanks
    A

  • Calling Java Function error

    Hi,
    I am trying to call a small hello world java function from Oracle 11g database.But i am getting the below errors:
    ORA-29516: Aurora assertion failure: Assertion failure at eox.c:342
    Uncaught exception System error: java/lang/UnsupportedClassVersionError
    ORA-06512: at "SCOTT.HELLOWORLD", line 1
    ORA-06512: at line 4
    The database version is 11.1.0.7.0 and jdk version is 1.6
    Plz let me know the reason for this.
    Thanks.

    This error seems to the incompatiable version of complied java with oracle database java version.
    Now Oracle 11g is use JDK 1.5. You have to compile the java files with the jdk version which is provided by oracle itself.
    So compile the java files with the ORACLE_HOME/jdk/bin/javac

  • Can we call java function in java script????

    hello
    please tell me can i call a java function through java script function in jsp???

    of course not. JavaScript is interpreted by the client (web browser) while the Java code in a JSP resides on the server. don't confuse the web application's architecture.
    robert

  • Newbie Help: Calling Java function from XSLT

    Hi everyone!
    I am trying to call a java function from my XSL file. like...
    <xsl:stylesheet version="1.0"
        xmlns:java="http://xml.apache.org/xslt/java"
        xmlns:fn="http://www.my.com/xslt"     
        exclude-result-prefixes="java fn">
    <xsl:variable name="embeddedpic"
    select="formData/instance/EmployeePicture" />
    <xsl:variable name="pic" select="fn:com.my.utils.ConversionUtils.base64DecodeString($embeddedpic)"/>I am getting this exception in calling the above java function from my XSLT (XalanXPathException: The function number 'http://xml.apache.org/xslt/java:com.my.utils.ConversionUtils.base64DecodeString' is not available.)I have the function lib file in my classpath but still i am getting this error. Any info is highly appreciated.
    Thanks

    Try this.
    <?xml version="1.0" ?>
    <xsl:transform version="1.0" xmlns:fn="com.my.utils" >
    <xsl:variable name="pic" select="fn:ConversionUtils.base64DecodeString($embeddedpic)"/>
    etc.
    as long as your code is in the classpath it should find it.
    Henock.

Maybe you are looking for

  • No data in SMOREPMA table even when the BW workbooks are visible

    Hi, We’ve connected the CRM system and the BW system successfully. In BW System, the workbooks, queries and the users with respective roles have been assigned. Now using the transaction SMOBILEBW in CRM, we are able to view the workbooks and the quer

  • PDF Printing with FOP/Apache Tomcat/J4LFOPServer in windows

    Hi everyone, I have been learning to create pdf report with Apex 4.2 and BI Publisher 10 which I have been successful with. Now I like to learn how to create pdf reports using FOP thinking of the customers who will not spend money on BI Publisher. I

  • 'Submit To' Based on Number in Table Cell

    Hi, Upon clicking a Submit button, I'm trying to have my form go to certain people based on a number in a table cell. For example, if the dollar amount in the table cell I named "TotalPrice" is $1,000 or greater, it goes to one group, and if it is le

  • Multiple BP Currency and Payments

    Hi All, The scenario is we have a BP to whom we do the sales billings in multiple currency eg. USD & EUR and system currency or local currency is SGD. Have created a BP master with multiple currency and it looks fine as far as sale invoice is concern

  • Video Rendering Option - Premiere CC 2014

    Hi, I need your help. I updated my premiere cc on thursday of last week, and today i found the first problem of the new version. As you can see in the photos attach, the previous version have the option to choose if i want the render and preview, by