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

Similar Messages

  • 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

  • How to call a Store Procedure with IN PARAMETER

    Hi, im new using Oracle 10G with Oracle SQL Developer, my cuestion is how to call a Store Procedure with IN PARAMETER, I tried the following without results
    SELECT * FROM procedure_name(parameter);
    PROCEDURE procedure_name(parameter);
    EXEC procedure_name(parameter);
    CALL procedure_name(parameter);
    Please help me....

    Hi,
    As Beijing said,
    EXEC procedure_name(parameter);
    CALL procedure_name(parameter);work for me.
    So does
    BEGIN
        procedure_name(parameter);
    END;Can you be more specific about what you're doing? That is, are you testing it in SQL Developer? Where are you entering the commands? Where are you looking for output? Do you get error messages? Does anything else (like "SELECT SYSDATE FROM dual;") work?

  • How to call java stored procedure using RMI?

    Is it possible to make a call to java stored procedure using RMI. ?
    How can I run the RMI registry on the Oracle Server ?

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Thomas Grounds ([email protected]):
    Is it possible to make a call to java stored procedure using RMI. ?
    In principle it is possible. See the Java-Doc.s of Oracle 8.1.6.
    I have successful granted the java.net.SocketPermissions in my USER_JAVA_POLICY view (see Doc.) Now I was able to use the RMI-Sockets, but following
    failure try to connect to RMI-Object via RMIregistry an Oracle Error occurs
    ORA-03113: end-of-file on communication channel
    and after that my Oracle Connection is closed.
    How can I run the RMI registry on the Oracle Server ?<HR></BLOCKQUOTE>
    I think you do not need the RMI registry on Oracle Server. It should be possible to start the RMI registry wherever you want in your network and access it via the right registry string.
    Ciao
    Margit
    null

  • How to call a store procedure

    Hi there,
    I'm very new to this jdeveloper for bpel and I would like to know how do you call a stored procedure with parameters.
    I've been using dbadapters to insert and update database with a transform function but I don't know if you need to do transformation do a stored procedure.

    Hi,
    have you read:
    http://download-east.oracle.com/docs/cd/B31017_01/integrate.1013/b28994/adptr_db.htm#CHDFBBCD

  • How to call java class from pl/sql procedure ?

    Hello everyone,
    My query is..
    There is one pl/sql stored procedure which is doing some business logic and storing data in some columns of one table, suppose the table name is 'ABC' .. and the rest of columns of table ABC are getting updated using java class. Now my problem is whenever I insert data in ABC using store proc.. i have to call that java class so that it will update the rest columns ( why java class for updating the columns in ABC is ..because that logic cant be done from pl/sql proc.. it has to be done using java )
    and the other thing is.. oracle is in one machine and java is in another .. :(
    hope ..u can help me out !!
    Thank in advance !!

    but that updation have to be done from java code only.. we are using GIS tools .. have to create some shape files and update the column with that shape file.. so creation of shape file has to be done from java code only..
    so how to call java class file which is on another machine and oracle in another..

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

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

  • How to call a stored procedure from WorkShop

    Hello Everyone .. I'm quite new with WebLogic 8.1 & WorkShop, so please bare with
    me .. Today I'm simply trying to find out how to call a stored procedure from
    within workshop, using any of the DB Controls .. I see workshop provides a way
    create a Java Control, Rowset Control, but it wont easily allow for a stored procedured
    to be entered in place of the inline query .. Perhaps I've over looked it. Any
    advise on the best way to tackle this task will be appreciated.
    Atahualpa

    Atahualpa--
    Maybe this will help:
    http://edocs.bea.com/workshop/docs81/doc/en/workshop/guide/controls/database/conStoredProcedures.html
    Eddie
    Atahualpa wrote:
    Hello Everyone .. I'm quite new with WebLogic 8.1 & WorkShop, so please bare with
    me .. Today I'm simply trying to find out how to call a stored procedure from
    within workshop, using any of the DB Controls .. I see workshop provides a way
    create a Java Control, Rowset Control, but it wont easily allow for a stored procedured
    to be entered in place of the inline query .. Perhaps I've over looked it. Any
    advise on the best way to tackle this task will be appreciated.
    Atahualpa

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

  • Calling Hana Store Procedure thorugh Eclipse link

    Hi,
    Anybody having idea of calling HANA store procedure through Eclipse Link JPA.
    Procedure has Scalar IN Parameter and Table Type as OUT Param:
    CREATE PROCEDURE tree_view (IN  topicid BIGINT,OUT qtree tt_tree)
        LANGUAGE SQLSCRIPT
        READS SQL DATA AS  
    BEGIN
    /// SQL Statements
    END;
    Currently i an calling the procedure as
    entiyManager.getTransaction().begin();
                java.sql.Connection connection = entiyManager.unwrap(java.sql.Connection.class);
                connection.setAutoCommit(false);
                CallableStatement cst = connection.prepareCall("call _SYS_BIC.\"workspace.procedures/tree_view\"(?,?)");
                cst.setLong(1, identifier);
                cst.execute();
                ResultSet rs =  cst.getResultSet();
         entiyManager.getTransaction().commit();
    But need more cleaned way like using StoreProcedureQuery or PLSQLStoredProcedureCall.

    Slightly missed the point.
    The question was about providing an INPUT variable.
    An in fact it is not possible to call a procedure with an table type input variable from the SQL console.
    You have to build a wrapper to call such a procedure:
    create type myusers as table (user_name nvarchar(60));
    create procedure count_users (IN user_tab myusers, OUT user_count bigint )
    language sqlscript
    as
    begin
        select count(*) into user_count from :user_tab;
    end;
    call count_users (? , ?)
    Could not execute 'call count_users (? , ?)' .
    SAP DBTech JDBC: [7]: feature not supported:
    Parameterized input table parameter is not allowed: line 1 col 19 (at pos 18)
    A wrapper for this could look like this:
    create procedure call_cu (out user_count bigint)
    language sqlscript
    as
    begin
        v_users = select user_name from users;
        call count_users (:v_users, :user_count);
    end;
    call call_cu (?)
    --> 28
    Unlike SQL*Plus for PL/SQL, the SQL console of SAP HANA is not a SQL Script runtime shell.
    - Lars

  • 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

  • Oracle JBDC error while calling the store procedure

    HI All,
    I am get one strange error while calling a store procedure which has two parameter in and out.
    I am pass the correct XML file which reaches the RDB and then PI receives a exception error message saying:
    oracle.rdb.jdbc.common.RdbException: Closed Resultset
    where as no error log is availble in RBD for the same.
    Can anybody tell me what can be the cause of the error.
    Let me know if you requires more information on this.
    -adi

    Hi Kiran,
    Thanks..
    But I am not able to understand you. I am calling a store procedure not a table. and we not doing anything in the store procedure except return one constant value in Out parameter.
    -Adi

  • How to call  java program from ABAP

    Hi Experts,
         My requirement is to call java programs from ABAP. For that i have set up SAP JCO connection by using this link http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/739. [original link is broken] [original link is broken] [original link is broken] Connection gets sucessfully. After this how to call java program from ABAP as per our requirement. Please help me out.
      Also i tried this way also.. but while executing the DOS Command line appear & disappear in few seconds. So couldnt see the JAVA output. Please help me out to call java programs in ABAP..
    DATA:command TYPE string VALUE 'D:Javajdk1.6.0_20 injavac',
    parameter TYPE string VALUE 'D:java MyFirstProgram'.
    CALL METHOD cl_gui_frontend_services=>execute
    EXPORTING
    application = command
    parameter = parameter
    OPERATION = 'OPEN'
    EXCEPTIONS
    cntl_error = 1
    error_no_gui = 2
    bad_parameter = 3
    file_not_found = 4
    path_not_found = 5
    file_extension_unknown = 6
    error_execute_failed = 7
    OTHERS = 8.
    Thanks.

    This depends on the version of your Netweaver Java AS. If you are running 7.0, you will have to use the Jco framework. The Jco framework is deprecated since 7.1 though. If you want to build a RFC server in 7.1 or higher, it is adviced that you set it up through JRA.
    Implement an RFC server in 7.0:
    http://help.sap.com/saphelp_nw04/helpdata/en/6a/82343ecc7f892ee10000000a114084/frameset.htm
    Implement an RFC server in 7.1 or higher:
    http://help.sap.com/saphelp_nwce72/helpdata/en/43/fd063b1f497063e10000000a1553f6/frameset.htm

Maybe you are looking for

  • Safari quit unexpectedly when I try to open my gmail box for working

    Hello Safari quit unexpectedly with this message Thank you Process:         WebProcess [3654] Path: /System/Library/StagedFrameworks/Safari/WebKit2.framework/WebProcess.app/Conten ts/MacOS/WebProcess Identifier:      com.apple.WebProcess Version:    

  • Flash Player 10 incompatible with Firefox/Chrome

    I am seeing this issue listed in forums all over the net, yet not here.  (May just be that I'm sick of looking now.)  Plain and simple:  Something in the Adobe Flash Player causes the browsers, and in most cases the computer, to lock up.  On this for

  • LO Extractor

    Hello, I am currently extracting field BESTA from the VASTI datasource.  I am wondering what this field represents, and where its values can be viewed on a screen that an end user would see. I have seen its values in SE11 and the table level, but I a

  • Cannot download from OTN

    Hello, When I try to download Oracle Database 9i for unix server AIX5L the browser doesn't progress. The ping to the server is timed out. Could you tell me if the download function is available? Thanks for your answer. R.Junck

  • Data Merge error message

    I keep receiving this message when selecting Data Source in InDesign: "The data source cannot be opened. Confirm that the file exists and that you have rights to open it, then choose the Select Data Source command again." I saved my excel file as a .