Java Store Procedures

Hi Guys,
Does anyone know if it is possible to implement a java store procedure that will be subsequently called in a "select" operation within a "where" statement in Oracle 9R2?
Thanks,
Andrea

Hi Andrea,
From your sample code, I get the impression that you aren't too familiar
with Oracle (and perhaps even databases in general?). This leads me
to believe that you are looking for someone who will do your work for
you. If that is the case, then I suggest you employ an independent
contractor (or consultant) who, I'm sure, will be more than happy to
accomodate you -- and I'm sure will do a much better job than I can
(via this forum).
Please forgive me if my interpretation is incorrect, however I feel,
that with a little effort on your behalf, you can find the solutions
to your problem by looking through the Oracle documentation, sample
code and "how-to" documents that are available from Oracle's "Technet"
web site:
http://technet.oracle.com
If, after that, you run into a specific problem, then please ask a
specific question on this forum and I will try to provide a specific
answer (if I can :-).
Good Luck,
Avi.

Similar Messages

  • Need help on processing XML doc using Java store procedure

    I am currently working on project to read, parse XML document and store data in XML document into database columns. I use JAVA API-OracleXMLSave in my java store procedure to do it, which use URL of XML doc to read, parse doc and store the data to database columns. My java store procedure works fine when XML doc is saved in server, but got "ORA-29532: Java call terminated by uncaught Java exception:
    oracle.xml.sql.OracleXMLSQLException: No such file or directory" if XML doc is in client's PC instead of in server. I think the problem comes from the URL that created using OracleXMLSave
    --createURL(fileName) based on the filename. what will be the filename if XML document located in Client PC like C:\myprojects\xmldoc.xml?
    Thank you in advance if anyone can give some hints.

    I am currently working on project to read, parse XML document and store data in XML document into database columns. I use JAVA API-OracleXMLSave in my java store procedure to do it, which use URL of XML doc to read, parse doc and store the data to database columns. My java store procedure works fine when XML doc is saved in server, but got "ORA-29532: Java call terminated by uncaught Java exception:
    oracle.xml.sql.OracleXMLSQLException: No such file or directory" if XML doc is in client's PC instead of in server. I think the problem comes from the URL that created using OracleXMLSave
    --createURL(fileName) based on the filename. what will be the filename if XML document located in Client PC like C:\myprojects\xmldoc.xml?
    Thank you in advance if anyone can give some hints.

  • Oracle Java Store Procedure and JNI

    Hi ! 'Is the anybody out there ?'
    We don't know. We are developing a java store procedure in Oracle 9i. We need to use a propetary .so file about cript/decript information (entrust file). So have to use in oracle a .jar file with all software infrastructure that use this .so file. But, we have a problem. 'Cause, in windows, we can use a .dll file from our java store procedure, but when we run under unix aix, we have problem about jni.
    java.library.path in oracle console is empty.
    So we cannot find our share object... have you got an idea ?
    thanks!!
    andrea

    Oracle lite does not support the use of PL/SQL procedures or triggers in the database, so unfortunately you just cannot use them.
    as an alternative you need to either
    a) include the setting on the client records when they are created
    b) use before insert/update triggers on the main oracle database to populate the columns. NOTE if doing this you will find that the user that is actually responsible for the inserts and updates to the main database is MOBILEADMIN (as it is running the apply process. If you just want to log the fact that it was client created fine, but will not tell you the creating user)
    c) you should be able to use pure java stored procedures on the client (if in the main oracle database, they should replicate across, but beware of jvm differences and any advanced stuff that may not be supported. you will also have to get any necessary jar files over to the client as well)
    We have used method a) as a standard method called for all inserts/updates in the java client APPLICATION software based on the existance of the audit columns, rather than within the database as it is simpler

  • JAVA STORE PROCEDURE

    Hi all,
    My question is suppose my java store procedure tries to open an socket with an IP address/port number. What r the priviledges does the "USER" needs to run the procedure?
    If that priviledes has not grant to the user, then what will be the error should throw by Oracle?

    try the following :
    SYSTEM User needs to perform
    call dbms_java.grant_permission('CANDS_QA', 'java.util.PropertyPermission',
    '*','read,write');
    commit;
    then try your code again.
    null

  • How to load and define Java Store Procedures using Consolidator Manager??

    Hi,
    I am trying to create a store procedure with a very easy example and I can not succeed. i am a bit new with OLite and I will appreciate any help from your side. I am quite lost now regarding of using java with OLite and it is becoming quite urgent for me. Thanks a lot in advanced.
    Those are the steps that I follow:
    - Creating the java class
    I create the java file MYUPPER.java with next code :
    public class MYUPPER {
    public static String doUpper( String p_text )
    return p_text.toUpperCase();
    I compile it and I create the jar file:
    C:\>javac MYUPPER.java
    C:\>jar cf MYUPPER.jar MYUPPER.class
    - This is an abstract of my java code using the API:
    ( m_cm is ConsolidatorManager)
    // Create the java resource
    m_cm.createStoredProc( "MYUPPER.jar", "MYUPPER", "doUpper", "doUpper");
    // Add it to the publication
    m_cm.addJavaResource( "PMTS", "MYUPPER" );
    - After running that code I do not receive any exception and checking into the repository looks ok:
    a) From the Mobile Server I can see the Java Ressource MYUPPER for that publication
    b) I can see the entries in C$Resouces and in C$Pub_Objects as well
    *** ON THE CLIENT:
    Then I go to the client device a Windows XP labtop where I did install the jre 5.0 and I added the bin path to the system variable PATH.
    - I get a POL-8000 error when synchronizing (could not start the Java Visrtual Machine)
    - Anyway, I can see the MYUPPER.class file deployed in the same directory than the databases are.
    - I have also tried next from msql:
    c:\>msql system/manager@jdbc:polite:tomeu_conscli
    Oracle Lite MSQL Version 10.3.0.2.0
    Copyright (c) 1997, 2008, Oracle. All rights reserved.
    Connected to: Oracle Lite ORDBMS
    Database Name: CONSCLI (Read Write)
    Database Version: 10.3.0.2.0
    Auto Commit: off
    Driver Name: oracle.lite.poljdbc.POLJDBCDriver (OLite 4.0)
    SQL> select * from c$resources;
    PUB_NAME | DB_NAME | RESOURCE_NAME | RESOURCE_TYPE | RESOURCE_DATA
    PMTS | pmts | MYUPPER | JAVA CLASS | -¦¦¥ 1
    1 row(s) returned
    SQL>
    SQL> exit
    Disconnected from CONSCLI
    c:\>msql system/*****@jdbc:polite:tomeu_pmts
    Oracle Lite MSQL Version 10.3.0.2.0
    Copyright (c) 1997, 2008, Oracle. All rights reserved.
    Connected to: Oracle Lite ORDBMS
    Database Name: PMTS (Read Write)
    Database Version: 10.3.0.2.0
    Auto Commit: off
    Driver Name: oracle.lite.poljdbc.POLJDBCDriver (OLite 4.0)
    SQL> select doUpper('fhjdjf') from dual;
    [POL-8035] no such attribute or method
    SQL> create table sp (id number(1) primary key );
    Table created
    SQL> alter table sp attach java source "MYUPPER" in '.';
    [POL-8028] error in calling a Java method
    SQL> commit;
    Commit complete
    SQL> select sp.doUpper('fhjdjf') from dual;
    [POL-8035] no such attribute or method
    Lost... :(
    Tomeu

    sorry to bother, similar like above, i tried many times on my computer to load a simple image in java application.. here's my code:
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.io.*;
    import java.net.*;
    import javax.swing.*;
    public class View extends JFrame {
         private URL imageURL;
         private File file;
         private Image sourceImage;
         private String name, title, message;
         private int width, height;
        public static void main(String[] args) {
            System.out.println( "Hello Eros!!!" );
            View img = new View();
        public View() {
             name = "D:/shared/inputpic.gif";
             file = new File( name );
            Toolkit toolkit = Toolkit.getDefaultToolkit();
            try {
                imageURL = new URL("http://www.google.com.my/images/logo_sm.gif" );
            } catch (MalformedURLException e) {
            if ( file == null ) {
                sourceImage = Toolkit.getDefaultToolkit().getImage( name );
                System.out.println( file );
            } else {
                sourceImage = toolkit.getImage( imageURL );
                System.out.println( file );
            width = sourceImage.getWidth( this );
            height = sourceImage.getHeight( this );
            System.out.println( "Pixel = " + width + "x" + height );
            if ( width * height == 1 ) {
                title = "Greetings";  // Shown in title bar of dialog box.
                if ( file == null ) {
                    message = "Unable to load the file " + name;
                } else {
                    message = "Unable to load the link " + imageURL;
                JOptionPane.showMessageDialog(null, message, title, JOptionPane.INFORMATION_MESSAGE);
    }could anyone test this n give my the reason i couldnt even load the image

  • Oracle Java stores procedure call for MQ Series

    Hi,
    I am trying to use MQ Series Queues from Oracle Java stored procedure through JMS. Can anyone guide me how to do that?. I mean what jar files I supposed to load into data base apart from my JMS client Code?.
    Thanks !!

    Oracle JMS client libraries work only with Oracle AQ/JMS. These will not work with MQ series.
    You might have to load MQ series JMS client libraries.
    null

  • XML and Java Store Procedures

    I have written JDBC Classes that are using OracleXMLObject and they are successfully working outside of Oracle.
    I can successfully load them and create procedures for them. But, when I call them, I'm told that method does not exist.
    Please help, can you provide a working example?
    Regards,
    Bruce

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Mark Abram ([email protected]):
    Can you post some snippets of your code
    so we can have a better idea what you trying to do?<HR></BLOCKQUOTE>
    Dear Mark,
    Here is the code:
    import java.sql.*;
    import java.math.*;
    import oracle.xml.sql.query.*;
    import oracle.jdbc.*;
    import oracle.jdbc.driver.*;
    //Title:
    //Version:
    //Copyright: Copyright (c) 1999
    //Author: Bruce Kearney
    //Company: Atrion International
    //Description:
    public class IncidentTypeDB {
    // public static void main(String args[]) throws SQLException
    public void getEverything()
    try
    Connection connection = new OracleDriver().defaultConnection();
    OracleXMLQuery query = new OracleXMLQuery(connection, "select " +
    "incidenttypeidseq, incidenttype from incident_type");
    query.setMaxRows(query.MAXROWS_ALL);
    query.setRowsetTag("ROOTDOC");
    query.setRowTag("DBROW");
    String xmlString = query.getXMLString();
    System.out.println(xmlString);
    connection.close();
    } catch (SQLException e)
    System.out.println("Error retrieving record.");
    System.out.println(e.toString());
    return;
    } catch (Exception e)
    System.out.println("Error connecting to database.");
    System.out.println(e.toString());
    return;
    Regards,
    Bruce
    null

  • How to call Java Store Procedure?

    Hi Everybody,
    I had created a java class call FileReader and inside tht class it has two method
    fileCount and fileName. fileCount is to locate the specified directory and count number of file and directory are in that directory and return back to the pl/sql and fileName is to return the filename for a specified directory. I also created a Oracle Package to call this call and the code for the java class and package listed below.
    CREATE OR REPLACE PACKAGE "CIS2"."PK_FILE_READER" AS
    FUNCTION F_GET_FILE_COUNT(P_DIR IN VARCHAR2) RETURN NUMBER;
    FUNCTION F_GET_FILE_NAME(P_DIR IN VARCHAR2, P_POS IN NUMBER) RETURN VARCHAR2;
    END PK_FILE_READER;
    CREATE OR REPLACE PACKAGE BODY "CIS2"."PK_FILE_READER" AS
    FUNCTION F_GET_FILE_COUNT(P_DIR IN VARCHAR2) RETURN NUMBER
    AS LANGUAGE JAVA NAME 'FileReader.fileCount(java.lang.String) return int';
    FUNCTION F_GET_FILE_NAME(P_DIR IN VARCHAR2, P_POS IN NUMBER) RETURN VARCHAR2
    AS LANGUAGE JAVA NAME 'FileReader.fileName(java.lang.String, int) return java.lang.String';
    END PK_FILE_READER;
    Class : FileReader
    import java.io.*;
    public class FileReader
    public static int fileCount(String dir)
    int recount;
    File path = new File(dir);
    File[] FileList = path.listFiles();
    recount = FileList.length;
    return recount;
    } // end method fileCount
    public static String fileName(String dir, int pos)
    String filename;
    File path = new File(dir);
    File[] FileList = path.listFiles();
    filename = FileList[pos].getAbsolutePath();
    return filename;
    } // end method fileName
    } // end of class FileReader
    The package created successful and the Java complite okey
    The only problem is when I try to use the loadjava it give me the oracle error ora-29545
    badly formed class
    I am not sure what is the problem? Did I create the java problem for FileReader is incorrect? or I don't know how to use the loadjava function.
    I did check the user_object and I did see there is a object name for FileReader but is invalid.
    Can anyone could tell me what is the problem and how to fix it??
    Thanks you so much

    The good news is, there's nothing wrong with your code:
    SQL> SET  serveroutput ON SIZE 1000000
    SQL> SET  lines 1000
    SQL> SET  pages 100
    SQL>
    SQL> exec dbms_java.set_output(2000)
    PL/SQL procedure successfully completed.
    SQL>
    SQL>
    SQL> CREATE AND COMPILE JAVA SOURCE NAMED "FileReader" AS
      2  import java.io.*;
      3 
      4  public class FileReader
      5  {
      6  public static int fileCount(String dir)
      7  {
      8  int recount;
      9 
    10  File path = new File(dir);
    11  File[] FileList = path.listFiles();
    12 
    13  recount = FileList.length;
    14 
    15  return recount;
    16  } // end method fileCount
    17 
    18  public static String fileName(String dir, int pos)
    19  {
    20  String filename;
    21 
    22  File path = new File(dir);
    23  File[] FileList = path.listFiles();
    24 
    25  filename = FileList[pos].getAbsolutePath();
    26 
    27  return filename;
    28  } // end method fileName
    29 
    30  } // end of class FileReader
    31  ;
    32  /
    Java created.
    SQL> SELECT owner, object_type, status, dbms_java.longname(object_name) class, created, last_ddl_tim
    e
      2  FROM   all_objects
      3  WHERE  substr(object_type,1,4)='JAVA'
      4  AND    dbms_java.longname(object_name) LIKE '%FileReaderp%'
      5  /
    no rows selected
    SQL> SELECT owner, object_type, status, dbms_java.longname(object_name) class, created, last_ddl_tim
    e
      2  FROM   all_objects
      3  WHERE  substr(object_type,1,4)='JAVA'
      4  AND    dbms_java.longname(object_name) = '%FileReader%'
      5  /
    OWNER                         OBJECT_TYPE        STATUS
    CLASS
    CREATED   LAST_DDL_
    APC                            JAVA CLASS         VALID
    FileReader
    28-FEB-06 28-FEB-06
    APC                            JAVA SOURCE        VALID
    FileReader
    28-FEB-06 28-FEB-06
    8 rows selected.
    SQL> CREATE OR REPLACE PACKAGE  "PK_FILE_READER" AS
      2 
      3  FUNCTION F_GET_FILE_COUNT(P_DIR IN VARCHAR2) RETURN NUMBER;
      4 
      5  FUNCTION F_GET_FILE_NAME(P_DIR IN VARCHAR2, P_POS IN NUMBER) RETURN VARCHAR2;
      6 
      7  END PK_FILE_READER;
      8  /
    Package created.
    SQL>
    SQL> CREATE OR REPLACE PACKAGE BODY "PK_FILE_READER"  AS
      2 
      3  FUNCTION F_GET_FILE_COUNT(P_DIR IN VARCHAR2) RETURN NUMBER
      4  AS LANGUAGE JAVA NAME 'FileReader.fileCount(java.lang.String) return int';
      5 
      6  FUNCTION F_GET_FILE_NAME(P_DIR IN VARCHAR2, P_POS IN NUMBER) RETURN VARCHAR2
      7  AS LANGUAGE JAVA NAME 'FileReader.fileName(java.lang.String, int) return java.lang.String';
      8 
      9  END PK_FILE_READER;
    10  /
    Package body created.
    SQL>
    SQL> var n number
    SQL> exec :n := PK_FILE_READER.F_GET_FILE_COUNT('C:\temp')
    PL/SQL procedure successfully completed.
    SQL> print n
             N
           295
    SQL> So this is obviously a configuration issue.
    Cheers, APC

  • Calling a Java Store Procedure from PL\SQL

    I have this code in pl/sql
    FUNCTION validate_against_schema (p_schema IN VARCHAR2, p_xml IN BLOB)
    RETURN VARCHAR2
    AS
    LANGUAGE JAVA
    NAME 'JAVA_SCHEMA_VALIDATOR.validation(java.lang.String, java.sql.Blob) return java.lang.String';
    And when i'm calling it i'm getting the following error:
    ORA-00932: inconsistent datatypes: expected an IN argument at position 2 that is an instance of an Oracle type convertible to an instance of a user defined Java class got an exception while converting to the user class
    I had this code working in another database user, but in the new user i get this error. There's something i have to do for the conversation BLOB-> java.sql.Blob run without a problem?

    Antonio,
    Are you sure you didn't use oracle.sql.BLOB instead of java.sql.Blob?
    Cheers,
    Colin

  • Problem Using Java Store Procedure (java class) to connect to sybase

    Hi, I'm trying to use a java class to obtain some data from another databse (SYBASE) in another server.. here are the code
    package pkg;
    import com.sybase.jdbcx.SybDriver;
    import java.sql.Connection;
    import java.sql.Driver;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    public class clsTest
    public clsTest()
    public static void main(String[] args)
    testConn("");
    private static void testConn()
    Connection _con= null;
    String host = "XXX";
    String port= "XXX";
    String url = host + ":" + port;
    Statement _stmt= null;
    int timeout = 10;
    boolean needsReconnect = true;
    SybDriver sybDriver = null;
    try
    Class c = Class.forName("com.sybase.jdbc3.jdbc.SybDriver");
    sybDriver = (SybDriver) c.newInstance();
    DriverManager.registerDriver((Driver) sybDriver);
    catch (Exception e)
    System.err.print("Unable to load the Sybase JDBC driver. "
    + e.toString());
    e.printStackTrace(System.out);
    if (needsReconnect)
    try
    if (_con != null)
    _con.close();
    url="jdbc:sybase:Tds:BDSERVER:PORT/BD";
    System.err.println("Trying to connect to: " + url);
    DriverManager.setLoginTimeout(timeout);
    con = DriverManager.getConnection(url,"usrquery","mundial");
    _stmt = _con.createStatement();
    boolean results = _stmt.execute("select count(*) from TABLA");
    if (results)
    ResultSet rs= _stmt.getResultSet();
    rs.next();
    System.err.println(rs.getString(1));
    _con.close();
    catch (SQLException sqle)
    System.err.println(sqle.toString() + " Restart connection.");
    return;
    catch (Exception e)
    e.printStackTrace();
    System.err.println("Unexpected Exception: " + e.toString());
    return;
    When I run the proyect using the IDE JDeveloper I have no problem, but when I make de use loadjava I receive these error message
    creating : resource META-INF/MANIFEST.MF
    loading : resource META-INF/MANIFEST.MF
    Error while creating resource META-INF/MANIFEST.MF
    ORA-29547: Java system class not available: oracle/aurora/rdbms/Compiler
    creating : class pkg/clsTest
    loading : class pkg/clsTest
    creating : resource jconn3.jar
    loading : resource jconn3.jar
    Error while creating resource jconn3.jar
    ORA-29547: Java system class not available: oracle/aurora/rdbms/Compiler
    granting : execute on class pkg/clsTest to public
    Error while computing shortname of pkg/clsSybaseLAE
    ORA-06550: line 1, column 13:
    PLS-00201: identifier 'DBMS_JAVA.SHORTNAME' must be declared
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    resolving: class pkg/clsTest
    errors : class pkg/clsTest
    ORA-29521: referenced name java/lang/StringBuffer could not be found
    ORA-29521: referenced name java/lang/Class could not be found
    ORA-29521: referenced name com/sybase/jdbcx/SybDriver could not be found
    ORA-29521: referenced name java/sql/Driver could not be found
    ORA-29521: referenced name java/sql/DriverManager could not be found
    ORA-29521: referenced name java/lang/System could not be found
    ORA-29521: referenced name java/lang/Exception could not be found
    ORA-29521: referenced name java/io/PrintStream could not be found
    ORA-29521: referenced name java/sql/Connection could not be found
    ORA-29521: referenced name java/sql/Statement could not be found
    ORA-29521: referenced name java/sql/ResultSet could not be found
    ORA-29521: referenced name java/sql/SQLException could not be found
    ORA-29521: referenced name java/lang/Object could not be found
    ORA-29521: referenced name java/lang/String could not be found
    synonym : pkg/clsTest
    The following operations failed
    resource META-INF/MANIFEST.MF: creation
    class pkg/clsTest: resolution
    resource jconn3.jar: creation
    exiting : Failures occurred during processing
    Please some one help me!.. Thank's a lot

    Thanks, you was right, but I have another problem
    The following operations failed
    class cl/bcch/clsSyBase: resolution
    source cl/bcch/clsSyBase: creation (createFailed)
    oracle.aurora.server.tools.loadjava.ToolsException: Failures occurred during processing
         at oracle.aurora.server.tools.loadjava.LoadJava.process(LoadJava.java:1057)
         at oracle.jdeveloper.deploy.tools.OracleLoadjava.deploy(OracleLoadjava.java:124)
         at oracle.jdeveloper.deploy.tools.OracleLoadjava.deploy(OracleLoadjava.java:53)
         at oracle.jdevimpl.deploy.OracleDeployer.deploy(OracleDeployer.java:98)
         at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:503)
         at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:381)
         at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:300)
         at oracle.jdevimpl.deploy.StoredProcProfileDt$Action$1.run(StoredProcProfileDt.java:598)
    #### Export incomplete. #### 09-01-2008 02:28:39 PM
    *** Note ***
    One possibility for the database export failure is that the target Database may not support JDK version 1.4. Updating your Project Properties compiler Source & Target to an earlier release could fix this problem.
    ************

  • How to call Java Store Procedure Part III

    Hi APC
    Everything is working now but when I exce this line
    exec :n := PK_FILE_READER.F_GET_FILE_COUNT('C:\')
    It did give me a number of file count but the problem was the C:\ dir is from
    the server side not from the local PC C Drive.
    My question is there a way you can point to your local drive? or your network drive? to get the file count
    thanks
    david

    You would either need to have some component that runs on the client machine (i.e. an application you deploy on the client either directly or through something like an ActiveX control/ Java applet on a web site) or your client file system would have to be mounted and accessible to the server at the file system level.
    In other words, not easily.
    Justin

  • Passing array from java stored procedure to plsql

    I have a java store procedure that is parsing an xml document and returning element values to my plsql application(8.1.7). I'm mapping a java.lang.String return type to VARCHAR2. However I'm running into the 4k limit when trying to return a string from java that is over 4k. Truncation of varchar returning over 4k is a known issue in 8i.
    So my next idea was to split that value of the element into 2000char and put in an array then pass that back to the plsql procedure. I know that oracle.sql.ARRAY can be converted into a plsql TABLE. But I believe you can only use the oracle.sql.ARRAY type when you are doing jdbc programming and are working with a connection.
    SO FINALLY MY QUESTION IS...
    Can anyone think of a solution that will allow me to pass over 4k of character data from my java stored procedure (not jdbc), back to my plsql app?
    Thanks.

    My understanding is that oracle 8 has a 4k limitation on any plsql function return data. A varchar can hold 32k within a function/package, but it cannot return more than 4k outside it's scope.
    Do you have an example you could share where you use the clob as a return type?
    Thanks!

  • Java Store Procs/Store Procs/Triggers

    Hi,
    I have cases in my application where I would require Store Procedures or triggers.
    Can I use Java Store Procedures, Regular Store procedures and triggers with iFS.
    Thanks,
    Mario

    We have not published the schema for IFS because it is not supported to write PL/SQL triggers or Java Stored Procedures based on changes in the underlying database tables.
    The supported way to handle these requirements is to write an Agent which registers for IfsEvents, and does work based on what events have occurred.
    See the JavaDoc for "IfsEvent" for more information.

  • Problems calling external Web Service from a Java Stored Procedure

    I'm using a sample code that I found here about calling external web services from a Java Store Procedure ( Credit Agency Web Service http://www.oracle.com/technology/sample_code/tech/java/jsp/samples/wsclient/Readme.html ) but when I run it ,send this error. I dont know what can I do or what is missing. Please help me. Thanks.
    Error: Premature EOF encountered [java.io.EOFException] [SOAPException: faultCode=SOAP-ENV:IOException; msg=Premature EOF encountered; targetException=java.io.EOFException: Premature EOF encountered] at org.apache.soap.SOAPException.(SOAPException.java:77) at oracle.soap.transport.http.OracleSOAPHTTPConnection.send(OracleSOAPHTTPConnection.java:765) at org.apache.soap.rpc.Call.invoke(Call.java:261) at oracle.otnsamples.wsclient.CreditAgencyServiceStub.authorizeCustomer(CreditAgencyServiceStub.java:84) at Products.jspService(Products.jsp:120) at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java:139) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:349) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:795) at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330) at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:794) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112) at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192) at java.lang.Thread.run(Thread.java:534)

    I'm also facing problem in running the example on the page http://www.oracle.com/technology/sample_code/tech/java/jsp/samples/wsclient/Readme.html
    I've Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 and Oracle Application Server 10g (10.1.3). When I executed the following command,
    loadjava -thin -user sys/password@localhost:1521:oradb -resolve -synonym -verbose -grant public %OC4J_HOME%/webservices/lib/soap.jar %OC4J_HOME%/lib/dms.jar %OC4J_HOME%/jlib/javax-ssl-1_1.jar %ORACLE_HOME%/lib/servlet.jar %OC4J_HOME%/j2ee/home/lib/mail.jar
    ... mentioned in step 3 under the "Configuring the Application" section on the above link, the process terminates with the following error
    The following operations failed
    class oracle/net/www/protocol/https/Handler: resolution
    class oracle/net/www/protocol/https/HttpsURLConnection: resolution
    class oracle/soap/client/ProviderManagerClient: resolution
    class oracle/soap/client/ServiceManagerClient: resolution
    class oracle/soap/providers/JavaProvider: resolution
    class oracle/soap/providers/ejbprov/EntityEJBProvider: resolution
    class oracle/soap/providers/ejbprov/StatefulEJBProvider: resolution
    class oracle/soap/providers/ejbprov/StatelessEJBProvider: resolution
    class oracle/soap/providers/sp/SpProvider: resolution
    class oracle/soap/server/http/SOAPServlet: resolution
    class oracle/soap/transport/http/OracleSOAPHTTPConnection$1: resolution
    class oracle/soap/transport/http/OracleSOAPHTTPConnection: resolution
    class org/apache/soap/messaging/Message: resolution
    class org/apache/soap/rpc/Call: resolution
    class org/apache/soap/rpc/RPCMessage: resolution
    class org/apache/soap/rpc/Response: resolution
    class javax/net/DefaultServerSocketFactory: creation (createFailed)
    class javax/net/DefaultSocketFactory: creation (createFailed)
    class javax/net/ServerSocketFactory: creation (createFailed)
    class javax/net/SocketFactory: creation (createFailed)
    class javax/net/ssl/DefaultSSLServerSocketFactory: creation (createFailed)
    class javax/net/ssl/DefaultSSLSocketFactory: creation (createFailed)
    class javax/net/ssl/HandshakeCompletedEvent: creation (createFailed)
    class javax/net/ssl/HandshakeCompletedListener: creation (createFailed)
    class javax/net/ssl/SSLException: creation (createFailed)
    class javax/net/ssl/SSLHandshakeException: creation (createFailed)
    class javax/net/ssl/SSLKeyException: creation (createFailed)
    class javax/net/ssl/SSLPeerUnverifiedException: creation (createFailed)
    class javax/net/ssl/SSLProtocolException: creation (createFailed)
    class javax/net/ssl/SSLServerSocket: creation (createFailed)
    class javax/net/ssl/SSLServerSocketFactory: creation (createFailed)
    class javax/net/ssl/SSLSession: creation (createFailed)
    class javax/net/ssl/SSLSessionBindingEvent: creation (createFailed)
    class javax/net/ssl/SSLSessionBindingListener: creation (createFailed)
    class javax/net/ssl/SSLSessionContext: creation (createFailed)
    class javax/net/ssl/SSLSocket: creation (createFailed)
    class javax/net/ssl/SSLSocketFactory: creation (createFailed)
    class javax/security/cert/Certificate: creation (createFailed)
    class javax/security/cert/CertificateEncodingException: creation (createFailed)
    class javax/security/cert/CertificateException: creation (createFailed)
    class javax/security/cert/CertificateExpiredException: creation (createFailed)
    class javax/security/cert/CertificateNotYetValidException: creation (createFailed)
    class javax/security/cert/CertificateParsingException: creation (createFailed)
    class javax/security/cert/X509Certificate: creation (createFailed)
    exiting : Failures occurred during processing
    I've checked the path to all the jar files.
    I tried to run the command again with system/password instead sys/password but then I got the following stacktrace:
    The following operations failed
    class oracle/net/www/protocol/https/Handler: resolution
    class oracle/net/www/protocol/https/HttpsURLConnection: resolution
    class oracle/soap/client/ProviderManagerClient: resolution
    class oracle/soap/client/ServiceManagerClient: resolution
    class oracle/soap/providers/JavaProvider: resolution
    class oracle/soap/providers/ejbprov/EntityEJBProvider: resolution
    class oracle/soap/providers/ejbprov/StatefulEJBProvider: resolution
    class oracle/soap/providers/ejbprov/StatelessEJBProvider: resolution
    class oracle/soap/providers/sp/SpProvider: resolution
    class oracle/soap/server/http/SOAPServlet: resolution
    class oracle/soap/transport/http/OracleSOAPHTTPConnection$1: resolution
    class oracle/soap/transport/http/OracleSOAPHTTPConnection: resolution
    class org/apache/soap/messaging/Message: resolution
    class org/apache/soap/rpc/Call: resolution
    class org/apache/soap/rpc/RPCMessage: resolution
    class org/apache/soap/rpc/Response: resolution
    exiting : Failures occurred during processing
    Thanks in advance for any useful help.
    -

  • Permission problem calling a java object from a store procedure

    When I run my store procedure
    CREATE OR REPLACE PACKAGE BODY confirms_write_to_file
    AS
    FUNCTION translate(in_en_var in VARCHAR2)
    RETURN VARCHAR2
    AS LANGUAGE JAVA
    NAME 'translate.translatePath(java.lang.String) return java.lang.String';
    PROCEDURE write_to_file(in_file_name IN VARCHAR, in_en_var IN VARCHAR)
    IS
    file_handle               UTL_FILE.FILE_TYPE;
    file_location VARCHAR2(50);
    BEGIN
    file_location := translate(in_en_var);
    dbms_output.put_line ('opened file location' ||file_location);
    END write_to_file;
    END confirms_write_to_file;
    I get the following error:
    exec confirms_write_to_file.write_to_file('zzzz','$RIMS_LOG');
    SQL> exec confirms_write_to_file.write_to_file('zzzz','$RIMS_LOG');
    Exception java.security.AccessControlException: the Permission
    (java.io.FilePermission <<ALL FILES>> execute) has not been granted by
    dbms_java.grant_permission to
    SchemaProtectionDomain(RIMS|PolicyTableProxy(RIMS))
    opened file locationProcess problem
    PL/SQL procedure successfully completed.
    When I try to to grant myself the permissions
    begin
    dbms_java.grant_permission('rims','java.io.FilePermission','*','execute');
    dbms_java.grant_permission('rims', 'java.lang.RuntimePermission', '*','writeFileDescriptor' );
    end;
    I get the following Error:
    oracle.aurora.vm.IdNotFoundException: rims is not a user or role
    at oracle.aurora.rdbms.DbmsRealm.getId(DbmsRealm.java)
    at oracle.aurora.rdbms.DbmsRealm.getId(DbmsRealm.java)
    at
    oracle.aurora.rdbms.security.PolicyTableManager.findAll(PolicyTableManager.java)
    at oracle.aurora.rdbms.security.PolicyTableManager.find(PolicyTableManager.java)
    at
    oracle.aurora.rdbms.security.PolicyTableManager.activate(PolicyTableManager.java
    at
    oracle.aurora.rdbms.security.PolicyTableManager.grant(PolicyTableManager.java)
    begin
    ERROR at line 1:
    ORA-29532: Java call terminated by uncaught Java exception:
    oracle.aurora.vm.IdNotFoundException: rims is not a user or role
    ORA-06512: at "SYS.DBMS_JAVA", line 0
    ORA-06512: at line 2
    My java code is as follows
    import java.io.*;
    import java.util.*;
    class translate
         public static String translatePath(String envar)
              Runtime rt = Runtime.getRuntime();
              int bufSize = 4096;
              byte buffer[] = new byte[bufSize];
              String path = null;
              Process p = null;
              int len = 0;
              try
                   p = rt.exec("echo "+envar);
                   BufferedInputStream bis = new BufferedInputStream(p.getInputStream());
                   while ((len = bis.read(buffer, 0, bufSize)) != -1)
                        System.out.write(buffer, 0, len);
                   path = new String(buffer);
                   p.waitFor();
              catch(Exception e)
                   System.out.println("Exception "+e);
                   return "Process problem ";
              return path;

    Tony,
    I answered this very same question that you posted at the JavaRanch forum.
    Good Luck,
    Avi.

Maybe you are looking for

  • Error while saving Bex Query

    Hi all I created a Global RKF in Query desinger and when i click on Save button, it is throwing error [Query name] contains errors do you want to save anyway? why i am not able to create RKF, If i delete that RKF and click SAVE its working fine, but

  • How to define certain document type (BKPF-BLART) for certain movement (101)

    Sometimes ( I think it is becuase of the tcode)  certain purchase 101 movements create a WA type FI document and some other times purchase 101 movements create WE type FI documents. I have seen a table ( accessing from omba transaction) in which for

  • How do I get the Organizer to show file names?

    I'm lost and confused in Photoshop 13. How do i get the file names to be displayed in Organizer? I've chosen to keep the older version of the "grid" display and miss having the file names showing. I've searched the online manual but can't seem to fin

  • Can't run project, "No recent history launches"

    Hey guys, I used to use Eclipse a few years ago but i stopped. Currently I'm using Eclipse Mars for Windows 64-bit. I'm facing one problem right now... I can't run my project, whenever I did, Eclipse will state that there is no recent history...I don

  • Problem in a Formula.!!

    Hi all I have a KF( TRANSACTION),for which I get negative Values,So I want to make that to ZERO if negative.I made it through an IF STATEMENT... But now based on that formula,I need to calculate TOTAL SALES.. TOTAL SALES= CHARGE + TRANSACTION. When I