How to call java function in Oracle forms?

Hi I am having Oracle 9i with 10g Developer Suite.
I am new to Oracle forms..
I had one function in java getDatas()..
How can I call this function in Oracle Forms..
Pls help
Thanks

Thanks Francois,
I want to display values from my java code in the Forms..
For that purpose only i am installing 10g Developer Suite..
The below is java code..
public class DBTest {
          public static String callDB(int id,String name){
          String ss="Hai";
          Connection con=null;
          try{
               Class.forName("oracle.jdbc.driver.OracleDriver");
               con = DriverManager.getConnection("url","id","pwd");
               Statement st=con.createStatement();
               System.out.println("Connected...");
          int r=st.executeUpdate("Insert into FORM_TEST VALUES('"+id+"','"+name+"')");
               if(r==1){
                    ss="Inserted Sucessfully";
               else{
                    ss="Insertion Failed";
          }catch(final Exception e){
          System.out.println(e);
          return ss;
     public static void main(String[] args) {
          int empid=102;
          String empname="Gilbert";
          String resultStr=callDB(empid,empname);
          System.out.println(resultStr);
I want to dispaly Inserted or Insertion Failed in Oracle Forms..
As per Gerd Volberg suggestion, i had placed DBTest.jar in
E:\DevSuite\forms\java\DBTest.jar
and in formsweb.cfg the below jar is added..
archive_jini=frmall_jinit.jar,DBTest.jar
But in Fomrs Builder-->Program-->Import Java Classes-->Oracle
org,ice,com and subnodes are available.
But my jar is not available..
Is my way is coorect?
Pls provide soln..
Thanks

Similar Messages

  • 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.

  • 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)

  • How to use java programe in oracle form

    Hello Expert,
    My Config is : -
    Forms [32 Bit] Version 11.1.1.3.0 (Production)
    Jdeveloper - 10.1.3
    I want to use the java programe in form builder. I create the one java class in Jdeveloper -
    package demo;
    import java.net.InetAddress;
    import java.net.NetworkInterface;
    import java.net.SocketException;
    import java.net.UnknownHostException;
    public class get_info{
       public static void main(String[] args){
       ch_add();
       public static void ch_add()
      InetAddress ip;
      try { 
      ip = InetAddress.getLocalHost();
      /*System.out.println("Current IP address : " + ip.getHostAddress());  */
      NetworkInterface network = NetworkInterface.getByInetAddress(ip);
      byte[] mac = network.getHardwareAddress();
      /*System.out.print("Current MAC address : ");   */
      StringBuilder sb = new StringBuilder();            
      for (int i = 0; i < mac.length; i++)
      sb.append(String.format("%02X%s", mac[i], (i < mac.length - 1) ? "-" : ""));
      System.out.println(sb.toString()); 
      } catch (UnknownHostException e) {
      e.printStackTrace();
      } catch (SocketException e){
      e.printStackTrace();
    and this into Formweb.cfg and default.env and also add into Form_class_path. After that i import this java into forms.
    Code genertated -
    PACKAGE BODY get_info IS
      -- DO NOT EDIT THIS FILE - it is machine generated!
      args   JNI.ARGLIST;
      -- Constructor for signature ()V
      FUNCTION new RETURN ORA_JAVA.JOBJECT IS
      BEGIN
        args := NULL;
        RETURN (JNI.NEW_OBJECT('demo/get_info', '()V', args));
      END;
      -- Method: main ([Ljava/lang/String;)V
      PROCEDURE main(
        a0    ORA_JAVA.JARRAY) IS
      BEGIN
        args := JNI.CREATE_ARG_LIST(1);
        JNI.ADD_OBJECT_ARG(args, a0, '[Ljava/lang/String;');
        JNI.CALL_VOID_METHOD(TRUE, NULL, 'demo/get_info', 'main', '([Ljava/lang/String;)V', args);
      END;
      -- Method: ch_add ()V
      PROCEDURE ch_add IS
      BEGIN
        args := NULL;
        JNI.CALL_VOID_METHOD(TRUE, NULL, 'demo/get_info', 'ch_add', '()V', args);
      END;
      -- Method: wait (J)V
      PROCEDURE wait(
        obj   ORA_JAVA.JOBJECT,
        a0    NUMBER) IS
      BEGIN
        args := JNI.CREATE_ARG_LIST(1);
        JNI.ADD_LONG_ARG(args, a0);
        JNI.CALL_VOID_METHOD(FALSE, obj, 'demo/get_info', 'wait', '(J)V', args);
      END;
      -- Method: wait ()V
      PROCEDURE wait(
        obj   ORA_JAVA.JOBJECT) IS
      BEGIN
        args := NULL;
        JNI.CALL_VOID_METHOD(FALSE, obj, 'demo/get_info', 'wait', '()V', args);
      END;
      -- Method: wait (JI)V
      PROCEDURE wait(
        obj   ORA_JAVA.JOBJECT,
        a0    NUMBER,
        a1    NUMBER) IS
      BEGIN
        args := JNI.CREATE_ARG_LIST(2);
        JNI.ADD_LONG_ARG(args, a0);
        JNI.ADD_INT_ARG(args, a1);
        JNI.CALL_VOID_METHOD(FALSE, obj, 'demo/get_info', 'wait', '(JI)V', args);
      END;
      -- Method: equals (Ljava/lang/Object;)Z
      FUNCTION equals(
        obj   ORA_JAVA.JOBJECT,
        a0    ORA_JAVA.JOBJECT) RETURN BOOLEAN IS
      BEGIN
        args := JNI.CREATE_ARG_LIST(1);
        JNI.ADD_OBJECT_ARG(args, a0, 'java/lang/Object');
        RETURN JNI.CALL_BOOLEAN_METHOD(FALSE, obj, 'demo/get_info', 'equals', '(Ljava/lang/Object;)Z', args);
      END;
      -- Method: toString ()Ljava/lang/String;
      FUNCTION toString(
        obj   ORA_JAVA.JOBJECT) RETURN VARCHAR2 IS
      BEGIN
        args := NULL;
        RETURN JNI.CALL_STRING_METHOD(FALSE, obj, 'demo/get_info', 'toString', '()Ljava/lang/String;', args);
      END;
      -- Method: hashCode ()I
      FUNCTION hashCode(
        obj   ORA_JAVA.JOBJECT) RETURN NUMBER IS
      BEGIN
        args := NULL;
        RETURN JNI.CALL_INT_METHOD(FALSE, obj, 'demo/get_info', 'hashCode', '()I', args);
      END;
      -- Method: getClass ()Ljava/lang/Class;
      FUNCTION getClass(
        obj   ORA_JAVA.JOBJECT) RETURN ORA_JAVA.JOBJECT IS
      BEGIN
        args := NULL;
        RETURN JNI.CALL_OBJECT_METHOD(FALSE, obj, 'demo/get_info', 'getClass', '()Ljava/lang/Class;', args);
      END;
      -- Method: notify ()V
      PROCEDURE notify(
        obj   ORA_JAVA.JOBJECT) IS
      BEGIN
        args := NULL;
        JNI.CALL_VOID_METHOD(FALSE, obj, 'demo/get_info', 'notify', '()V', args);
      END;
      -- Method: notifyAll ()V
      PROCEDURE notifyAll(
        obj   ORA_JAVA.JOBJECT) IS
      BEGIN
        args := NULL;
        JNI.CALL_VOID_METHOD(FALSE, obj, 'demo/get_info', 'notifyAll', '()V', args);
      END;
    BEGIN
      NULL;
    END;
    Now i want to call the o/p of Java programe in oracle text item. Please help me. It's very urgent. I am not good in Java.

    Sir i use java importer.
    PACKAGE BODY get_info IS
      -- DO NOT EDIT THIS FILE - it is machine generated!
      args   JNI.ARGLIST;
      -- Constructor for signature ()V
      FUNCTION new RETURN ORA_JAVA.JOBJECT IS
      BEGIN
        args := NULL;
        RETURN (JNI.NEW_OBJECT('demo/get_info', '()V', args));
      END;
      -- Method: main ([Ljava/lang/String;)V
      PROCEDURE main(
        a0    ORA_JAVA.JARRAY) IS
      BEGIN
        args := JNI.CREATE_ARG_LIST(1);
        JNI.ADD_OBJECT_ARG(args, a0, '[Ljava/lang/String;');
        JNI.CALL_VOID_METHOD(TRUE, NULL, 'demo/get_info', 'main', '([Ljava/lang/String;)V', args);
      END;
      -- Method: ch_add ()V
      PROCEDURE ch_add IS
      BEGIN
        args := NULL;
        JNI.CALL_VOID_METHOD(TRUE, NULL, 'demo/get_info', 'ch_add', '()V', args);
      END;
      -- Method: wait (J)V
      PROCEDURE wait(
        obj   ORA_JAVA.JOBJECT,
        a0    NUMBER) IS
      BEGIN
        args := JNI.CREATE_ARG_LIST(1);
        JNI.ADD_LONG_ARG(args, a0);
        JNI.CALL_VOID_METHOD(FALSE, obj, 'demo/get_info', 'wait', '(J)V', args);
      END;
      -- Method: wait ()V
      PROCEDURE wait(
        obj   ORA_JAVA.JOBJECT) IS
      BEGIN
        args := NULL;
        JNI.CALL_VOID_METHOD(FALSE, obj, 'demo/get_info', 'wait', '()V', args);
      END;
      -- Method: wait (JI)V
      PROCEDURE wait(
        obj   ORA_JAVA.JOBJECT,
        a0    NUMBER,
        a1    NUMBER) IS
      BEGIN
        args := JNI.CREATE_ARG_LIST(2);
        JNI.ADD_LONG_ARG(args, a0);
        JNI.ADD_INT_ARG(args, a1);
        JNI.CALL_VOID_METHOD(FALSE, obj, 'demo/get_info', 'wait', '(JI)V', args);
      END;
      -- Method: equals (Ljava/lang/Object;)Z
      FUNCTION equals(
        obj   ORA_JAVA.JOBJECT,
        a0    ORA_JAVA.JOBJECT) RETURN BOOLEAN IS
      BEGIN
        args := JNI.CREATE_ARG_LIST(1);
        JNI.ADD_OBJECT_ARG(args, a0, 'java/lang/Object');
        RETURN JNI.CALL_BOOLEAN_METHOD(FALSE, obj, 'demo/get_info', 'equals', '(Ljava/lang/Object;)Z', args);
      END;
      -- Method: toString ()Ljava/lang/String;
      FUNCTION toString(
        obj   ORA_JAVA.JOBJECT) RETURN VARCHAR2 IS
      BEGIN
        args := NULL;
        RETURN JNI.CALL_STRING_METHOD(FALSE, obj, 'demo/get_info', 'toString', '()Ljava/lang/String;', args);
      END;
      -- Method: hashCode ()I
      FUNCTION hashCode(
        obj   ORA_JAVA.JOBJECT) RETURN NUMBER IS
      BEGIN
        args := NULL;
        RETURN JNI.CALL_INT_METHOD(FALSE, obj, 'demo/get_info', 'hashCode', '()I', args);
      END;
      -- Method: getClass ()Ljava/lang/Class;
      FUNCTION getClass(
        obj   ORA_JAVA.JOBJECT) RETURN ORA_JAVA.JOBJECT IS
      BEGIN
        args := NULL;
        RETURN JNI.CALL_OBJECT_METHOD(FALSE, obj, 'demo/get_info', 'getClass', '()Ljava/lang/Class;', args);
      END;
      -- Method: notify ()V
      PROCEDURE notify(
        obj   ORA_JAVA.JOBJECT) IS
      BEGIN
        args := NULL;
        JNI.CALL_VOID_METHOD(FALSE, obj, 'demo/get_info', 'notify', '()V', args);
      END;
      -- Method: notifyAll ()V
      PROCEDURE notifyAll(
        obj   ORA_JAVA.JOBJECT) IS
      BEGIN
        args := NULL;
        JNI.CALL_VOID_METHOD(FALSE, obj, 'demo/get_info', 'notifyAll', '()V', args);
      END;
    BEGIN
      NULL;
    END;
    I read both document which is given by you.
    Basicaly i don't know how to call java program in form builder.
    I wrote this code on When-button-pressed
    DECLARE
    jo ora_java.jobject;
    rv varchar2(1500);
    ex ora_java.jobject;
    BEGIN
    jo := get_info.new;
    rv:=get_info.ch_add(jo );
    EXCEPTION
    WHEN ORA_JAVA.JAVA_ERROR then
      message (' Unable to call out to Java, ' ||ORA_JAVA.LAST_ERROR );
      message('');
    WHEN ORA_JAVA.EXCEPTION_THROWN then
      ex := ORA_JAVA.LAST_EXCEPTION;
      message(' Unable to call out to Java ' ||Exception_.toString (ex ) );
      message(' Unable to call out to Java ' ||Exception_.toString (ex ) );
    END;
    No error comes and no output comes. I want the client MAC ID. please guide me where i need to change the code.

  • How to use Java Script in Oracle Forms 10g

    Hello,
    Appreciate if anyone could help me using Java Script in Oracle Forms 10g?
    Thanks
    GM

    Thank you for your reply. I was reading on the metalink that we could use the to call the java script from oracle Forms 10g (Doc ID 265863.1)
    Example:
    WEB.SHOW_DOCUMENT ('javascript:void(window.open("http://www.oracle.com","","location=no,toolbar=no,menubar=no,status=no,"));self.close()','_blank');
    I tried it but it did not open the any window as it claims. Am I missing anything? Is there any IE related setting which I need to modify for the above to work?
    Regards
    GM

  • How to call database procedure in oracle forms

    Hi,
    Can anyone describe me that how I'll call database procedure in oracle forms (6i,10g)?
    Thanks in Advance.
    Baloch

    Hi Francois,
    As I created a procedure in database as below
    create or replace procedure For_table (tbl_of in number,st_pnt in number,en_pnt in number) is
    begin
    for i in st_pnt..en_pnt loop
    dbms_output.put_line(tbl_of||'*'||i||'='||tbl_of*i);
    end loop;
    end For_table;
    The above procedure is working fine when I'm using PL/SQL. I call the above procedure as
    begin
    For_table(3,5,20);
    end;
    but nothing happen
    Thanks in Advance.
    Baloch

  • Calling java application from Oracle forms button

    Hi all,
    I have a problem. The idea is to call Java desktop application when button is pressed. I have used this (above) line of code, but there is no results. When I start form in local everything is fine but when I start from server it doesn't work. Does anyone has that kind of problem and how is solved?
    Thanks in advance.
    __Code is:__
    DECLARE
    v_path VARCHAR2(1000);
    BEGIN
    v_path:= '\\location\Java_Application.jar';
    HOST(v_path);
    END;

    First, please start here:
    http://blogs.oracle.com/shay/2007/03/02/
    As for what you are doing and the problem, it will be difficult to give an exact reason, but here are a few comments which will apply regardless of the platform, version, and installation type.
    1. In most case, when calling HOST from Forms the shell that is started does not include all of the system environment variables. This means for example, if a java.exe is needed (on Windows), you would need to specify its path as part of the call or use a batch file rather than calling a command or app directly. The batch file would first set all the needed environment variables (i.e. PATH, CLASSPATH, etc)
    2. If you are running a newer version of Forms, you have a middle tier. This is were your HOST call will be executed. So, if you are expecting this to occur on the client it will not work. You would need WebUtil for client side calls.
    3. Calling a network resource (i.e. shared drive) is not permitted on Windows platforms when called from a Windows Service. Doing so can be seen as a security vulnerability. This can be overridden, but I would suggest that doing so is not a good idea. All files needed to run your app should be made available locally. If files exist on a remote machine, they should be temporarily brought to the machine (e.g. using ftp, sftp, etc) where they are needed and removed later if necessary. If you are running a newer version of Forms, the Forms runtime process belongs to a Windows Service, even if indirectly as a child.
    4. Calling a jar directly is not the proper way to call a java app. Refer to the following:
    http://download.oracle.com/javase/tutorial/deployment/jar/run.html

  • Calling Java screens from Oracle Forms application

    I am working with a client that has a large Oracle forms application. Since rewriting the entire application in Java is not an option at this time, the strategic direction is that any new modules that are to be created for the application are to be done in Java and called from the Forms menu. The decision as to what tool to use to develop the Java modules is still under debate. What is the best (most seamless) way to do this...calling a Java screen from a Forms application? If anyone has any experience in this, or can direct me to some literature on it, it would be greatly appreciated. Thanks.

    This is a web app in Forms/Reports 10g R2 running off Oracle AS and an Oracle db. The challenge for us is that the direction is that any new enhancements (screens) are to be built using Java (in either ADF Faces or Swing, another point for debate later) and then called from the Forms app. The business client is only paying for the enhancement. They don't care about moving off Forms to Java, so any extra work on the part of IT to do this, has to be fairly minimal and doable within the project budget. The movement to Java is an IT direction. Is there a way to do this without having to build a java framework for the entire Forms application (which I assume would take some time and involve retesting the entire app)?

  • How to handle Java popup in oracle forms application through Open Script?

    I want to record and test oracle form application but it popup java dialogue box and Open Script can't handle java object.
    So how to handle the Java popups in forms application?

    Hi, Have you been able to resolve this?

  • How to call pdf files from oracle forms

    I have a pdf file in the server , I need to call this and open when a button is pressed in the oracle forms.
    Please let me know how to do this.
    Thanks,
    Previn

    Frank,
    I have oracle applications and I want to open a pdf file located in the server from a button in oracle applications.
    Previn,
    you don't mention the Forms release you are running.
    If you are running Forms on the web, you can use
    web.show_document() to load files from the Web if
    they are accessible via HTTP.
    Frank

  • How to use Java Beans in Oracle Forms 11g at 64 bit windows7

    Hello Experts,
                  I am using Oracle forms 11.1.2.2.0 with weblogic 10.3.6 generic at windows 7 64 bit.
    My java version is jdk1.7.0_51.
    Now I have a htmlbutton.jar (which is for bean item in oracle form and this jar file works well for oracle forms 11g 32 bit windows 7 environment).
    I have takken steps:
    1:-Put jar file in home\java folder.
    2:-add this jar file into archive in formsweb.cfg.
    3:-Add this this jar file(which is in my home- java folder) in form_class path in registry.
    Now when I try to locate this jar file in my oracle form.There is no such jar file.what are the steps to use this jar file in oracle forms bean item.
    Please told me what is wrong here.
    thank you
    regards
    aaditya.

    It is unclear where you are having a problem.  Is your issue at runtime (when the form runs in the browser) or when working in the Builder on the form?
    Also be aware that you will need to sign your jar and include some new manifest entries.  Refer to the Java 7u51 documentation and blogs that discuss the changes.
    https://blogs.oracle.com/java-platform-group/entry/new_security_requirements_for_rias
    http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/manifest.html

  • How to call .BAT file in Oracle Forms

    Hi All,
    I am using Oracle Forms 6i. We have a .Bat script which moves file from our local directory to the server.
    I want to invoke this .Bat script to be called when I click on a button in the form.
    Appreciate your help here.
    Thanks,
    Madhu K.

    Hi
    I use this in oracle forms 6i: first i assign this path to a variable:
    DECLARE
    v_path   VARCHAR2(1000);
    BEGIN
    v_path:= 'C:\file_name.bat'  then I use the host command:
    HOST( 'cmd /c start' || v_path , no_screen); 
    END;Hope this helps...
    Regards,
    Abdetu...

  • JavaFX : How to call java function that returns hashtable and manipulate

    I have a requirement to {color:#0000ff}create a java object in JavaFX script code{color}. Then call a java function using the created java object. The java function returns hashtable. Then traverse through each element of hashtable. Finally I need to create a similar structure in JavaFX.

    If you need to use a Java class that uses generics you need to take special steps. Since JavaFX does not support generics you need to create a java wrapper to hide the calls that use generics and call the wrapper class from FX.

  • How to call Java function which returns byteArray

    context I have a class say
    public class ByteArray{
      public byte[] getByteArray(String str){
           return str.getBytes();
    }Consider i have object of ByteArray (some how) in native C code. I want to call getByteArray("Test") and obtain a byteArray. what is the C JNI function can i use?

    hy
    CREATE OR REPLACE FUNCTION GET_SAL1(NN in NUMBER)
    RETURN BOOLEAN
    IS
    BEGIN
    INSERT INTO STD(ENO) VALUES(NN);
    RETURN TRUE;
    EXCEPTION
    WHEN OTHERS THEN
    RETURN false;
    END;
    you can call :
    if GET_SAL1(NN) then
    else
    error
    end if;
    I hope i understand
    Regards

Maybe you are looking for

  • OBIA out-of-the-box reports functionality documentation?

    Hi, I am in search of the documents/functionality guide for the OBIA out-of-box reports. Version: Oracle Business Intelligence Applications 7.9.6.1 Please let me know where we can find the Document explaining the list of the Out-of-box reports and th

  • Acrobat 8 Pro Upgrade

    If I get an upgrade for my version 8 Acrobat Pro, does it confirm the original version from my installed licensed version or do I need my original CD?

  • Photoshop CS, CS3, CS4, Flash 8, all crash on Macbook Pro 10.5.6

    Over time, I forget exactly when, Photoshop and Flash applications crash when attempting to start them. Photoshop CS would yield errors that referenced 'CarbonLib' in the error message. Macromedia Flash 8 simply crashes on startup, no further info. S

  • Alpha Channel Transparency Rendering

    Forgive me if this is somewhere on this forum as the forums are a bit confusing to me. If it is please point me in the right direction. I am trying to create a simple effect and then use that effect as a luma matte in a NLE like Final Cut Pro or Avid

  • Threading not working on Mail 6.2 and 10.8. What to do?

    I'd love to use threading mails. But the feature is extremely flakey for me. E.g. I see three mails with identical subject, sent on the same day next to each other in the same folder. * I have Mail.app > Settings > View > View conversations: Include