Can I use log4j with a java stored procedure

I have code that resides on the middle tier and on the database. Our company is using log4j for debugging purposes. In order to get my code to work on the database, I have had to remove all the log4j stuff. Has anyone tried to get code that has log4j messages to run on the database? I am not concerned with actual debugging, I just don't want to have to strip this code out if I can avoid it.

Hi Laura,
As far as I know, you have two choices:
1. Load the log4j classes into the database (using the "loadjava" tool).
2. Enable remote invocation of log4j classes via RMI (or similar).
Hope this helps.
Good Luck,
Avi.

Similar Messages

  • Using XMLType in a Java Stored Procedure

    I have the following piece of java test code that attempts to read an XMLType object from the database. When I run this client side, using either the oci or thin driver it works fine. When I run the same code as a java stored procedure I get the exception shown below.
    (The problem was first seen on 9.2.0.3/Win2K. Ive patched to 9.2.0.4 and am still getting the same error)
    Can anybody please help?
    Thanks
    Java Test Code:
    ===============
    import java.sql.*;
    import oracle.sql.*;
    import oracle.jdbc.*;
    import oracle.xdb.*;
    public class Test {
    public static void main(String[] args) throws Exception {
    System.out.println(run());
    public static String run() throws Exception {
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    // client side THICK
    //Connection conn = DriverManager.getConnection("jdbc:oracle:oci8:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SID=ORACLE)))", "scott", "tiger");
    // client side THIN
    //Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:ORACLE", "scott", "tiger");
    // server side
    Connection conn = DriverManager.getConnection("jdbc:default:connection");
    OracleCallableStatement stmt = (OracleCallableStatement)conn.prepareCall("{? = call XDBUriType('/test.xml').getXML()}");
    stmt.registerOutParameter (1, OracleTypes.OPAQUE,"SYS.XMLTYPE");
    stmt.execute();
    XMLType xml = XMLType.createXML(stmt.getOPAQUE(1));
    return xml.getStringVal();
    SQLPLUS TRACE:
    ==============
    SQL> VARIABLE res VARCHAR2(4000);
    SQL> call run() into :res;
    call run() into :res
    ERROR at line 1:
    ORA-29532: Java call terminated by uncaught Java exception:
    java.lang.Exception: Unimplemented Feature
    Dump File:
    ==========
    Dump file c:\oracle9i\admin\oracle\udump\oracle_ora_4964.trc
    Fri Oct 24 12:04:30 2003
    ORACLE V9.2.0.3.0 - Production vsnsta=0
    vsnsql=12 vsnxtr=3
    Windows 2000 Version 5.0 Service Pack 4, CPU type 586
    Personal Oracle9i Release 9.2.0.3.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.3.0 - Production
    Windows 2000 Version 5.0 Service Pack 4, CPU type 586
    Instance name: oracle
    Redo thread mounted by this instance: 1
    Oracle process number: 12
    Windows thread id: 4964, image: ORACLE.EXE
    *** 2003-10-24 12:04:30.000
    *** SESSION ID:(10.121) 2003-10-24 12:04:30.000
    java.lang.Exception: Unimplemented Feature
    at oracle.xdb.spi.XDBContext.getServerEnv(XDBContext.java)
    at oracle.xdb.XMLType.initConn(XMLType.java:1874)
    at oracle.xdb.XMLType.<init>(XMLType.java:846)
    at oracle.xdb.XMLType.createXML(XMLType.java:469)
    at cms.Test.run(Test.java:27)

    I have the very same problem. Somebody from Oracle Corp please reply. If this is a bug, please do not let us waste time to research a solution. Otherwise, point a way out!
    Thanks,

  • Using Directory alias in Java stored procedure

    hi !!
    I want use Directory alias in Java strored procedure
    I 'hv created dir alias as
    Create Directory BFILE_DIR AS 'C:\MyImages'
    my java statements -
    myfile="C:\MyImages\myPH01.jpg"
    File binaryFile = new File(myFile);
    instead of giving absolute path I want give directory alias BFILE_DIR
    myfile= BFILE_DIR + "myPH01.jpg"
    can anyone pl suugest how should I write this in Java procedure
    thanks
    SPD

    Hi there i am currently trying to develope a java
    stored procedure and place it in oracle and will try
    to use that procedure to send a message to a server
    but then it doesnt seems to work. is it possible?And what do you do with exceptions in your java proc?
    I haven't ever done it myself, but I would be very surprised if it wasn't possible. I also wouldn't be surprised to find out that you have to configure various things to allow it in Oracle itself.

  • Using socket programming in java stored procedure

    Hi there i am currently trying to develope a java stored procedure and place it in oracle and will try to use that procedure to send a message to a server but then it doesnt seems to work. is it possible?
    The server and the database is in the same pc and the server is just a small program listening to a port. Hope someone can help me thanks

    Hi there i am currently trying to develope a java
    stored procedure and place it in oracle and will try
    to use that procedure to send a message to a server
    but then it doesnt seems to work. is it possible?And what do you do with exceptions in your java proc?
    I haven't ever done it myself, but I would be very surprised if it wasn't possible. I also wouldn't be surprised to find out that you have to configure various things to allow it in Oracle itself.

  • Is it possible to use iFS API within java stored procedure?

    question:
    is it possible to use the iFS API for file handling
    within a java stored procedure (which is invoced by a trigger)?
    is there an "elegant" workaround if it is not possible?
    problem:
    my java code using the iFS API works fine outside
    the java stored procedure
    but invoked via trigger as java stored procedure
    it throws following exception:
    IFS-20102: Unable to start service (IfsDefault)
    i am using:
    oracle 9.0.1
    oracle internet file system 9.0.1.1.0
    windows 2000
    thanks

    thanks for your help
    i looked through the applications developers guide
    the basics behind advanced queueing (as far as i understand) is:
    program A inserts a message into the queue - and program B gets message from the queue and processes it
    question 1:
    but what is the difference between advanced queuing and a queue i create by myself
    (simply with a database table) and let application B (which runs in a loop)
    check if the queue is filled
    or am i missing something important which makes advanced queuing more practicable for my problem?
    question 2:
    you wrote about advanced queuing support in iFS 9.0.3, but the newest version i found was iFS 9.0.2
    did you reffer to the advanced queuing mechanism in general or to a spezial queuing feature in iFS 9.0.3?
    thanks

  • How to use directory alias in Java stored procedure ?

    hi everyone !
    I want use Directory alias in Java strored procedure
    I 'hv created dir alias as
    Create Directory BFILE_DIR AS 'C:\MyImages'
    my java statements -
    myfile="C:\MyImages\myPH01.jpg"
    File binaryFile = new File(myFile);
    instead of giving absolute path I want give directory alias BFILE_DIR
    myfile= BFILE_DIR + "myPH01.jpg"
    File binaryFile = new File(myFile);
    can anyone pl suugest how should I write this in Java procedure
    thanks
    SPD

    hi everyone !
    I want use Directory alias in Java strored procedure
    I 'hv created dir alias as
    Create Directory BFILE_DIR AS 'C:\MyImages'
    my java statements -
    myfile="C:\MyImages\myPH01.jpg"
    File binaryFile = new File(myFile);
    instead of giving absolute path I want give directory alias BFILE_DIR
    myfile= BFILE_DIR + "myPH01.jpg"
    File binaryFile = new File(myFile);
    can anyone pl suugest how should I write this in Java procedure
    thanks
    SPD

  • Script can not be invoked from a java stored procedure

    i made a java procedure and called it via a sql procedure which takes a string as input :
    the string is passed to Runtime.getRuntime().exec("myString");
    if that string is :
    rm -f /test/test22.log
    proc = Runtime.getRuntime().exec("rm -f /test/test22.log");
    the file test22.log which is in the test folder gets deleted
    but when i pass the command . /test/batchstart.ksh to execute a script the script does not execute.
    proc = Runtime.getRuntime().exec(". /test/batchstart.ksh");
    file permissions have been given and also the executable rights.
    if some bobdy can tell why the script is not executing that will be of great help

    i am Still facing the following problem:
    if i pass a parameter like :
    rm -f /test/menu.ksh
    then the required output is that the menu.ksh file gets deleted.
    but when i pass this command:
    ./test/menu.ksh
    It is supposed to execute the specified script but it does not.
    I have tried multiple things like giving chmod 777 rights to the following file and changing the command to /test/menu.ksh but nothing happens
    Can you kindly tell me what can the problem be. Is there any execution rights issue: i am executing these scripts from pl sql developer.
    You can find both the procedure and java method which is being called below
    ==========================================================================================
    create or replace procedure TEST_DISPLAY(filename in varchar2, result out varchar2, error out varchar2) is
    command varchar2(100);
    vRetChar varchar2(100);
    begin
    command := filename ;
    prc_host(command, vRetChar);
    result := vRetChar;
    dbms_output.put_line(result);
    Exception
    when No_Data_Found Then
    error := 'Command is not Found';
    dbms_output.put_line('Failure');
    return;
    end TEST_DISPLAY;
    ======================================================================
    create or replace and compile java source named host as
    import java.io.*;
    import java.lang.Runtime;
    import java.lang.Process;
    import java.io.IOException;
    import java.lang.InterruptedException;
    public class Host {
    public static void executeCommand(String command,String[] outString) {
    String RetVal;
    try {
    String[] finalCommand;
    final Process pr = Runtime.getRuntime().exec(command);
    // Capture output from STDERR...
    }

  • How to use a Java Thread in a Java Stored Procedure?

    I am working with java stored Procedures but i have a problem when i use threads.While the thread is running all the processes are blocked because the thread is not detatched.I don't know if it is impossible to use Thread in a java stored procedure.i made many researches but didn't find information about this case of Thread.If someone knows what to do in this case it will be helpfull for me.Thanks

    The JAR is already load by using CREATE JAVA RESOURCE ... or "loadjava -resolve –force -user p/p@SID –genmissing -jarasresource MyJar.jar"
    If we can create a resource by SQL or loadjava, how can I use it in my java code?
    Edited by: 847873 on 28 mars 2011 06:05
    Edited by: 847873 on 28 mars 2011 06:07

  • Error while executing java stored procedure from a pl/sql procedure

    We have a requirement where we need to execute JAVA code stored in an Oracle database (Java Stored Procedure). This code uses some JAR files which we have already loaded without any errors in the database.
    The class file was also loaded in the database without any errors. But when we execute the method of this class (JAVA code), it gives the following error:
    ORA-29532: Java call terminated by uncaught Java exception:
    java.lang.NoClassDefFoundError
    Is there any way of debugging the code and getting to know where exactly the problem is? Or, any tool/software available for doing the same.
    Any pointers would be of great help!
    Thanks in advance

    Hi Uday,
    My guess is that there is a problem with your java stored procedure that is causing the "ExceptionInInitializer" error to be thrown. According to the javadoc:
    is thrown to indicate that an exception occurred during
    evaluation of a static initializer or
    the initializer for a static variable
    Since I didn't see any of your code in your post, I can't help you much more, I'm afraid. Perhaps if you would provide some more details, I may be able to help you some more. I think the following details would be helpful:
    1. Complete error message and stack trace you are getting.
    2. The section of your java code that you think is causing the problem.
    3. Oracle database version you are using.
    Good Luck,
    Avi.

  • While executing java stored procedure i got an error

    I have used this command to load java source into data base
    loadjava -user ENCORA/ENCORA C:\framework\Packages\testdevelopement\HOST.java
    but while executing i got an error.
    SQL> create or replace function run_cmd(p_cmd in varchar2) return number
    2 as
    3 language java
    4 name 'HOST.RunThis(java.lang.String[]) return integer';
    5 /
    Function created.
    SQL> create or replace procedure RC(p_cmd in varchar2)
    2 as
    3 x number;
    4 begin
    5 x := run_cmd(p_cmd);
    6 end;
    7 /
    Procedure created.
    SQL> set serveroutput on size 1000000
    SQL> exec dbms_java.set_output(1000000)
    PL/SQL procedure successfully completed.
    SQL> exec rc('/usr/bin/ps -ef');
    BEGIN rc('/usr/bin/ps -ef'); END;
    ERROR at line 1:
    ORA-29540: class HOST does not exist
    ORA-06512: at "ENCORA.RUN_CMD", line 0
    ORA-06512: at "ENCORA.RC", line 5
    ORA-06512: at line 1
    can any one suggest me how can i resolve this problem?

    Hi Uday,
    My guess is that there is a problem with your java stored procedure that is causing the "ExceptionInInitializer" error to be thrown. According to the javadoc:
    is thrown to indicate that an exception occurred during
    evaluation of a static initializer or
    the initializer for a static variable
    Since I didn't see any of your code in your post, I can't help you much more, I'm afraid. Perhaps if you would provide some more details, I may be able to help you some more. I think the following details would be helpful:
    1. Complete error message and stack trace you are getting.
    2. The section of your java code that you think is causing the problem.
    3. Oracle database version you are using.
    Good Luck,
    Avi.

  • Error while executing Java Stored Procedure.

    Hi,
    When I'm trying to execute my java stored procedure i'm getting the following error:
    ORA-29532: Java call terminated by uncaught Java exception: java.lang.ExceptionInInitializerError
    Does anybody has idea why this error comes and how can be resolved.
    Thanks in advance.
    Uday

    Hi Uday,
    My guess is that there is a problem with your java stored procedure that is causing the "ExceptionInInitializer" error to be thrown. According to the javadoc:
    is thrown to indicate that an exception occurred during
    evaluation of a static initializer or
    the initializer for a static variable
    Since I didn't see any of your code in your post, I can't help you much more, I'm afraid. Perhaps if you would provide some more details, I may be able to help you some more. I think the following details would be helpful:
    1. Complete error message and stack trace you are getting.
    2. The section of your java code that you think is causing the problem.
    3. Oracle database version you are using.
    Good Luck,
    Avi.

  • Retrieving a UDT object from a Java Stored Procedure

    I am really having trouble returning a UDT object (AttributeUDT) from a Java stored procedure. I am using Oracle 8.1.6 and JDeveloper 3.2.2. I have successfully used JPublisher to create the Java source code files for my UDT, now I would like to use that in coordination with my Java stored procedure. I've loaded the Java stored procedure into the database using the Deployment option in JDeveloper. However, when it loads the procedure, it translates the 3rd parameter to an OBJECT type, thus making the stored procedure invalid. I can use SQL Navigator to correct the package by changing the OBJECT reference to AttributeUDT (my UDT data type). Unfortunately, my Java stored procedure still does not work. Any help would be greatly appreciated! Thanks in advance for your time!
    In the example below, could anyone please tell me:
    1. How do I register the OUT variable for the UDT?
    2. Is it correct to use the casted call to getObject to retrieve my UDT object?
    3. Is it valid to use the UDT data type in the java stored procedure method signature?
    The call to the Java stored procedure:
    OracleCallableStatement cs3 = (OracleCallableStatement)conn.prepareCall( "{ call sandbox.getQualifiersV3( ?, ?, ?) }");
    cs3.registerOutParameter( 1, Types.VARCHAR);
    cs3.registerOutParameter( 2, Types.VARCHAR);
    cs3.registerOutParameter( 3, ???????);
    cs3.execute();
    System.out.println( "ID: " + cs3.getString( 1));
    System.out.println( "Prompt: " + cs3.getString( 2));
    AttributeUDT attributes = (AttributeUDT)cs3.getObject( 3);
    System.out.println( "Table id: " + attributes.getLogicalTableId());
    System.out.println( "Element id: " + attributes.getElementId());
    cs3.close();
    ===========================================
    The Java stored procedure:
    public static void getQualifiersV3( String ids[], String prompts[],
    AttributeUDT attributes[]) throws SQLException {
    OracleConnection conn = (OracleConnection)new OracleDriver().defaultConnection();
    Statement stmt = conn.createStatement();
    OracleResultSet rs = (OracleResultSet)stmt.executeQuery(
    "SELECT * "
    + "FROM VPS_ABOK_QUALIFIERS "
    + "WHERE qualifier_id = 2001");
    rs.next();
    ids[0] = rs.getString( 1);
    prompts[0] = rs.getString( 2);
    attributes[0] = (AttributeUDT)rs.getCustomDatum( 3, AttributeUDT.getFactory());
    rs.close();
    stmt.close();
    null

    Sounds like your C2 REF TYP1 attribute may be null. Unfortunately you neglected to say where in your code the NullPointerException occurs.

  • How to create a java stored procedure

    hi @all
    i have no expierence with java
    my plan
    i want to select (create view) data from a table which is located in sql server db
    with a java stored procedure.
    i won't use the way Generic Connectivity/Transparent Gateways (http://download-west.oracle.com/docs/cd/A87860_01/doc/server.817/a76960/hs_admin.htm).
    can anybody help me?

    Download JDeveloper. Look for examples on http://otn.oracle.com.

  • View Java Stored Procedures

    Hello,
    How can I find the names of Java stored procedures
    created in the database and what are the published
    stored procedures?
    thanks
    Ranganath Samudrala

    Hi,
    There are two meta catalogs "okJavaObj" and "okJavaMember" that can be used to get all sorts of information for Java classes and Java methods. Some SQL commands are as follows:
    To see all Java classes stored in the database, type in the following select statement:
    select "Schema", "Name" from "okJavaObj" ;
    or you may want to create the following view:
    drop public synonym all_javaobjects;
    create or replace view all_javaobjects( Schema, Name, SuperClass, Type) as
    (select "Schema", "Name", "SuperClass", "Type" from "okJavaObj");
    grant select on all_javaobjects to public;
    create public synonym all_javaobjects for system.all_javaobjects;
    commit;
    You may want to create the following view to see classnames and methods
    drop public synonym all_methods;
    create or replace view all_methods
    (schema,classname, superclass, declaringclass, method_name, type, argcount, jnisignature) as
    select a."Schema", a."Name" as ClassName, a."SuperClass",
    b."DeclaringClass" , b."Name" as method_name , b."Type",
    b."ArgCount", b."JNISign" as jnisignature
    from "okJavaObj" a, "okJavaMember" b
    where a.POL_REF = b."DefinedIn";
    grant select on all_methods to public;
    create public synonym all_methods for system.all_methods;
    commit;

  • How do we connect to a remote database from a Java Stored Procedure?

    We have a situation where we are not able to use a PSP (PL/SQL server page) to update a remote database using database link in an Oracle8i database. This is a known bug on 8i and is fixed in 9i. Can this be done using PSP calling a Java stored procedure, which in turn connects to the remote database and performs the update. If so, how we do remote connectivity to another database from the current java stored procedure.

    We have a situation where we are not able to use a PSP (PL/SQL server page) to update a remote database using database link in an Oracle8i database. This is a known bug on 8i and is fixed in 9i. Can this be done using PSP calling a Java stored procedure, which in turn connects to the remote database and performs the update. If so, how we do remote connectivity to another database from the current java stored procedure.

Maybe you are looking for

  • Getting FRM-40010 Error While opening new form  .fmx

    Hi, Oracle apps : 11.5.10.2 Forms : Forms 6.0 I'm creating a custom form by using one oracle apps table.I created a basic form by using template.fmb and then saved it to directory "/dir1" and run this form by connecting to oracle apps database. When

  • Sync with Outlook problems

    I have a couple questions about synchronizing Outlook with the Nokia N80 using Nokia PC Suite 6.81. First, I have different subfolders under the Contacts list in Outlook. I want to sync all my contacts to my phone; however every time I sync, I can on

  • Why won't my tower synch with iCloud

    I upgraded my MacPro to Mountain Lion, so my tower should synch with my laptop and iPhone.  Yet even though I have the setting in iCloud in System Preferences set for Contacts and Calendar, neither is pulling in the information from the other devices

  • Aironet 1310 bridge: Ethernet error

    I have a 1310 that is getting a "system encounter an error initializing the ethernet port" on startup. It says to interrupt the boot seq and do a ether_init and then boot I have done that but it still comes back with unable to initialize ethernet. Is

  • Upsizing stuff

    Hello people. So I wanted to takea design i made in phtoshop and blow it up to 2 or 3 times its size. I know I can upsize in photoshop but im afraid it will ruin it or get pixelated. the thing is there is no photograph or anything with a lot of pixel