How to use a Java Resource??

Hello,
I need to know how to use my external JAR I loaded in the database (hosted in Oracle 10.2.04) using this line below:
CREATE OR REPLACE JAVA RESOURCE NAMED "MyJar" USING BFILE (BFILE_DIR,'MyExternal.jar');
In fact, I have a Java file using this JAR, but I do not know how to tell to the java source that it have to use this JAR.
==========Java Source importing the Jar===================
package com.gemalto.ws.snmp;
import java.io.IOException;
import java.util.Vector;
import org.snmp4j.Snmp;
import org.snmp4j.smi.*;
import org.snmp4j.TransportMapping;
import org.snmp4j.transport.DefaultUdpTransportMapping;
import org.snmp4j.CommunityTarget;
import org.snmp4j.mp.SnmpConstants;
import org.snmp4j.PDU;
import org.snmp4j.event.ResponseEvent;
public class SNMPAgent
==========================
Could you give the SQL request or loadjava command line permitting to do use my java resource file?
Thks

Hi,
I think you should not load the jar as java resource.
And I think there is no need to tell to the java source that it have to use the JAR. It will automatically look for the library.
You should load the jar file using the loadjava utility.
If it can helps, here is how I proceed :
/* LOAD .JAR FILE */
loadjava -user your_user/password@host -resolve -verbose -nodefiner C:\jdevstudio1013\jdev\lib\your_lib.jar
/* LOAD PROGRAM */
loadjava -user your_user/password@host -resolve -verbose -nodefiner C:\jdevstudio1013\jdev\mywork\your_program.java
/* CREATE THE PL/SQL FUNCTION */
create or replace procedure your_function(arg1 in varchar2, arg2 in varchar2) authid current_user as
language java name 'your_program.your_function(java.lang.String, java.lang.String)';
/* EXECUTE */
select your_function('hello','world') from dual;

Similar Messages

  • How to use a Java Resource in my java source

    Hello,
    I need to know how to use my external JAR I loaded in the database using this line below:
    CREATE OR REPLACE JAVA RESOURCE NAMED "MyJar" USING BFILE (BFILE_DIR,'MyExternal.jar');
    In fact, I have a Java file using this JAR, but I do not know how to tell to the java source that it have to use this JAR.
    ==========Java Source importing the Jar===================
    package com.gemalto.ws.snmp;
    import java.io.IOException;
    import java.util.Vector;
    import org.snmp4j.Snmp;
    import org.snmp4j.smi.*;
    import org.snmp4j.TransportMapping;
    import org.snmp4j.transport.DefaultUdpTransportMapping;
    import org.snmp4j.CommunityTarget;
    import org.snmp4j.mp.SnmpConstants;
    import org.snmp4j.PDU;
    import org.snmp4j.event.ResponseEvent;
    public class SNMPAgent
    ==========================
    Could you give the SQL request or loadjava command line permitting to do use my java resource file?
    Thks

    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

  • 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

  • How to Use the JAVA SCRIPT code in .htm page of the component

    Hi .
    In my requirement i have to use Java Script Function in .htm code ..how to use the java script code and functions in .htm???
    thank you
    B.Mani

    Check this document  [Arun's Blog|http://wiki.sdn.sap.com/wiki/display/CRM/CRMWebClientUI-TalkingwithJava+Script]
    Regards
    Kavindra

  • How to use the Java embedding activity in BPel

    hi all,
    How to use the java embedding activity in BPEL
    pls can u provide sample example

    1 Use [Oracle BPEL Process Manager Client Java API Reference|http://download-uk.oracle.com/docs/cd/B31017_01/integrate.1013/b28986/overview-summary.html] and especially [com.collaxa.cube.engine.ext|http://download-uk.oracle.com/docs/cd/B31017_01/integrate.1013/b28986/com/collaxa/cube/engine/ext/BaseBPELXExecLet.html]
    Instead of System.Out.println use addAuditTrailEntry(java.lang.String message)
    2. If you want to import a package write in code (Source View) of bpel process
    +<bpelx:exec import="package_name"/>+ for example +<bpelx:exec import="java.util.regex.Matcher"/>+
    example 1:
    String bodyAsString;
    StringBuffer myStringBuffer = new StringBuffer();
    try {
    bodyAsString = (String)getVariableData("BodyString");
    addAuditTrailEntry("bodyAsString1: "+ bodyAsString);
    Pattern pattern = Pattern.compile("goodDay");
    Matcher matcher= pattern.matcher(bodyAsString);
    while (matcher.find()) {   
    matcher.appendReplacement(myStringBuffer, "shitDay");
    matcher.appendTail(myStringBuffer);
    bodyAsString = myStringBuffer.toString();
    addAuditTrailEntry("bodyAsString2: "+ bodyAsString);
    } catch (Exception ex) {
    addAuditTrailEntry("Failed+bodyAsString",ex.getMessage());
    I put in code (Source View) the following
    <bpelx:exec import="java.util.regex.Matcher"/>
    <bpelx:exec import="java.util.regex.Pattern"/>
    example2:
    Object temp;
    try {
    temp = ((XMLElement)getVariableData("inputVariable","payload","/ns2:FiscalisMessage/ns2:Body")).getChildNodes().item(1);
    setVariableData("AdjReceipt",temp);
    addAuditTrailEntry("ok",temp.toString());
    catch (Exception ex) {
    addAuditTrailEntry("Failed :",ex);
    I put in code (Source View) the following
    <bpelx:exec import="oracle.xml.parser.v2.XMLElement"/>

  • How to use xliff as resource bundle ?

    I used to do Java i18n as following base on resource bundle in properties file format:
    Locale myLocale = new Locale("es", "ES");
    ResourceBundle bundle = ResourceBundle.getBundle("HelloResourceBundle", myLocale);
    System.out.println(bundle.getString("Hello"));I realized that there is new bundle called xliff like:
    <trans-unit id="Hello">
    <source>Hello how are you</source>
    <note>This is message to say hello</note>
    </trans-unit>Does java resource bundle support xliff file similar to properties file? if not, could anybody give an example how to handle xliff file?
    Thanks

    Following code worked for me:
    import oracle.javatools.resourcebundle.BundleFactory;
    import java.util.ResourceBundle;
    * This method retrieves localized strings from a given XLIF resource bundle.
    * @param bundleName The XLIF bundle from which the localized string is to be retrieved.
    * @param key The key of the localized string.
    * @return The localized string retrieved from the given XLIF bundle.
    public static String getXlifLocalizedString(String bundleName, String key) {
    if (StringUtils.isEmpty(key)) {
    return key;
    if (StringUtils.isEmpty(bundleName)) {
    return "[" + key + "]";
    String localizedString = null;
    ResourceBundle resourceBundle = null;
    try {
    resourceBundle = BundleFactory.getBundle(bundleName);
    localizedString = resourceBundle.getString(key);
    } catch (Exception e) {
    LOG.log(Level.SEVERE, "Problem in loading XLIF resource bundle: " + bundleName, e);
    return "[" + key + "]";
    return localizedString;
    }

  • How to use another java program to stop this running prpgram???

    Dear Sir:
    I have following code and I run it success,
    import java.util.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.*;
    public class CertainAndRepeatTime{
      public static void main(String[] args) throws IOException{
        int delay = 1;
        Timer timer = new Timer();
        ActionListener actionListener = new ActionListener() {
            public void actionPerformed(ActionEvent actionEvent) {
              System.out.println("Hello World Timer");
        System.out.println("What do you want (Certain time or Repeat time)?");
        System.out.print("Please enter \'C\' or \'R\' for that: ");
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String ans = in.readLine();
        System.out.print("Please enter  ans=" + ans  + " IsTrue=  " + (ans.equals("R") || ans.equals("r")) +"\n");
        if (ans.equals("C") || ans.equals("c")){
          //System.out.println("This line is printed only once start...");
          timer.schedule(new TimerTask(){
            public void run(){
              System.out.println("This line is printed only once.");
          },delay,1);
        else if(ans.equals("r") || ans.equals("R")){
            timer.scheduleAtFixedRate(new TimerTask(){
              public void run(){
                System.out.println("This line is printed repeatedly.");
            },delay, 1000);
          while(true){
               //System.out.println("Charles print This line is printed repeatedly.");          
          } //This will make your main thread hang.
        else{
          System.out.println("Invalid Entry.");
          System.exit(0);
        System.exit(0);
    }But I hope to use another java program to stop it when it is running instead of pressing CRTL + C to stop it.
    How to do it??
    Any example??
    Thanks a lot!!

    Sorry, I think i did not express cearly. It is my fault.
    I re-write my requirements again:
    I have
    Class AAA1.java,
    Class AAA2.java,
    Class AAA3.java,
    Class AAA20.java...
    etc
    they all look like the program I posted first time,, once executed, they will run for ever, and they will be stopped until I press CRTL + C;
    Now I hope to use another java class StopProgram.java to stop them 1 by 1 or at once instead of pressing CRTL + C;
    In this case, how to code this StopProgram.java ??
    Thanks

  • How to use/configure JAVA beans file in Forms10g?

    Hi!
    I'm using Forms10g. I need to use few java beans file in my forms. How do i call it and configure it. So, that i can access all the features of this file in Forms.
    Regards.
    Satyaki De.

    Hello,
    Java Beans Integration
    http://forms.pjc.bean.over-blog.com/article-4018331.html
    Hope it helps,
    Jose.

  • How to use external Java API in Java Embedd inside BPEL

    How to use external classes inside the BPEL in Java Embed Activity ? Any sample code availble ? Like i want to use log4j API inside BPEL.

    No you dont have to change your startManagedServer.cmd/.sh everytime you need to have a Java Embedding activity. You only need it in case of using Log4J. As log4j requires a configuration xml viz log4j.debug.xml and log4j.dtd you need to let the soa managed server know about it. The best way to load this configuration files is using the JAVA_OPTIONS command during server startup.
    Hope the explanation helps.

  • [Solved] How to use Oracle Java 6 for specific applications

    I use an IDE called PyCharm. On its download page, it recommends using Java 6 instead of OpenJDK. I currently have jdk7-openjdk installed, and from what I had read in the Arch Wiki on Java, it should be possible to install Oracle Java 6 along side OpenJDK 7.
    However, after installing jdk6-compat and jre6-compat, I still see that I am running OpenJDK 7 when I run the following:
    % java -version
    java version "1.7.0_09"
    OpenJDK Runtime Environment (IcedTea7 2.3.3) (ArchLinux build 7.u9_2.3.3-1-x86_64)
    OpenJDK 64-Bit Server VM (build 23.2-b09, mixed mode)
    ...even after I have set JAVA_HOME and added /opt/java6/bin to my path.
    How can I get PyCharm (or other applications) to use Oracle Java 6 instead of OpenJDK?
    Thanks, and apologies if I've posted in the wrong place.
    Other information that might be helpful:
    Running zsh as default shell
    Using Gnome 3 as DE
    Last edited by Nikorasu (2012-11-17 20:54:33)

    I found the solution.
    For Pycharm, I just needed to add an environment variable PYCHARM_JDK. For running specific applications, I asked this question on the Unix / Linux StackExchange and got an answer there.
    Also, after running PyCharm in Java 6... I would not recommend it. OpenJDK works fine
    Last edited by Nikorasu (2012-11-17 20:55:01)

  • How to use the java native api

    i am new to the java native api, can anyone tell me how to use it in order for me to use the c++ file in the java file?please explain it if possible, thanks

    Try this out to learn the basics :
    http://java.sun.com/docs/books/tutorial/native1.1/index.html
    You can't go wrong from there.

  • How to use the java class created by  "CONTIVO" as web sevrvice?

    Hi All,
    We are creating the java class by the Contivo mapping tool, how to use that class as a web serivce?
    Very thankful if anyone gives some light on this.
    Thanks in advance.....
    rgds,
    Rajeev Pariyadathu

    com.contivo.runtime.dom.Transform
    Transform.transform(     "Transform_HotelAvailRQ_",file1, file2);, like this we can use the contivo generated class

  • How to use a java class in difference project under a same workspace!

    Hi, there:
    I have a problem. I want to reuse a java class which is located in another project of the same workspace. I do not know how to set the two project setting or how to import the java class. I deeply appreciate.
    Sheng-He

    include it as a library
    open project settings goto libraries and simply add your class

  • How to use  Advance java function in graphical mapping in XI 2.0?

    Hi,
    currently I am using a simple java function to make an RFC call to R3 system.
    I want to avoid making connection for each lookup. Instead I want to make a single connection for whole message queue and get the corresponding values in some array or container object.
    please suggest a solution.
    I think this is possible using Advance java function, but I am not able to find any example on using Advance java function at help.sap.com.
    thaks in advance.

    Hi!!!
    I'm not sure if I understood you well.
    Do you want to preload some data into your structures in the memory and keep them there so you don't need to make a new connection during processing the whole message or every message?
    In my opinion you can cache some data during processing a message, but it's impossible to cache some data between processing messages.
    If you write your java mapping or you use graphical mapping (even with user-defined function), then you have a java class. The problem is that XI 2.0 reloads this class during processing every message, so even if you load some data from your data source into your structures in the memory, this data will be lost after reloading your mapping class.
    Regards,
    Andrzej Filusz

  • How to Use Multiple Java Runtimes

    Hi,
    I have installed two JRE versions (1.2.2 and 1.4.0_01) in my Machine (Windows platform).
    (The default if 1.2.2 as it was installed later)
    I want to run an application in either of the above JRE's. To do so...
    If I want to run the application on 1.2.2
    I use C:\jdk1.2.2\bin\java MyApplication
    If I want to run the application on 1.4
    I use C:\jdk1.4\bin\java MyApplication
    Basically I am hardcoding the path where the "java" executable lies..
    Now my question is, Is this the correct/only way to use different JRE's?? Is there any other cleaner way to use multiple java runtimes??
    There is some parameter for "java.exe" where we can set version
    like "java -Dversion=1.4.0_01". Can this be helpful??
    Thanks in advance
    Hiten

    You could use DOS environment variables to define the jre path to use.

Maybe you are looking for

  • Creative Cloud Says My Subscription is Ending, but Amazon Says Otherwise

    I subscribed to Adobe Creative Cloud late last month through my Amazon account and my school email address for a discount. I have been able to use the products fine so far for the past month, but I just got a pop-up when opening Photoshop today that

  • ICal and iClock unusual performance

    I have aligned this question with the nearest subject I can find. I recently purchased and installed 10.4.3 and upgrades to 10.4.5. Generally all went well but I noticed the time top r.h.corner was an hour slow (behind). I clicked on the date and at

  • Confusion on pair type and Processing Type

    Dear Experts I have the the below doubt in TIP Table Pair type  gives the information on the how the Time pairs being generated as 0-      Non recorded Time 1-      Attendences 2-      Absences 3-      Attendences Recorded from client  Processing Typ

  • Swf conflicts with menu generated through javascript

    Hi all. I have a menu generated through the SoThink menu builder with drop downs. The drop-downs come over a media file (swf) that has a slideshow playing. When the image on the slideshow changes, I lose my drop downs that fall in that basic area. He

  • Keywords from previous import lost

    In prior versions, LR facilitated importing images from multiple cards by retaining the previous settings in the import dialog. In version 3.all, it clears out the keywords section. This means you have to retype all those keywords, with every single