Java from Xquery

I am try to call java method from Oracle XQUERY using OJXQI on middle tier
XQueryContext ctx = new XQueryContext();
try
String str = "declare namespace m=\"java:java.lang.Math\"; \n"
" let $r:=m:random() \n"
" return $r";
// prepare the query
PreparedXQuery xq = ctx.prepareXQuery(strm);
// get a resultset
XQueryResultSet rset = xq.executeQuery();
But I get errors that method with parameters not found.
Is this the correct way to call java from oracle Xquery?
Any help on that is appreciated ?

The OJXQI API is an outdated early prototype before we released a much more scalable database-native XQuery implementation in Oralce Database 10g Release 2 last year. If your use case allows, you can use JDBC to access database-native Oracle XQuery.
Regards,
Geoff

Similar Messages

  • Call java class from xquery

    Hi All,
    I'm working on osb 11.1.1.5 version.As per my requirement i want to call the external java class from the Xquery (version 1.0).Anybody can u please provide me any links or examples?
    Thanks in Advance!
    Radhika.

    Hi Prabu Thx for ur reply....without custom functions is there any possibilities to do this from xquery?

  • How do i uninstall java from my MacBook Pro running Lion?

    I would like to uninstall Java from my Lion OS running MacBook Pro. *it got installed a while back while running a Java program, and due to Fashback and other holes, I would like it off of my system, other than a complete re-install, how do I remove it?
    Thanks in advance.

    CT wrote:
    Uninstalling Java on Lion
    There's a lot more installed than what that article says. The Java installation package includes much more than just:
    /System/Library/Java/JavaVirtualMachines/
    Take a look at the package with Pacifist.

  • How to call business service from xquery transformation in OSB ??

    Hi All,
    How to call business service from xquery transformation in OSB ??
    I need to assign the response variable of Business Service to a target element in XQuery Transformation Mapper file.
    It's urgent.
    Regards,
    Jyoti Nayak

    Transformation is to mapping the source and target of 2 different schemas.
    In your case you should have a XQuery transformation between, your Business Service output schema and the target schema.
    Thanks,
    Vijay

  • Call java from ABAP

    JCo connectivity is used to call RFCs from Java. can i call Java from abap?
    thanks in advance.....
    regards,
    Sundararamaprasad

    Hi Sundar ,
             This link will surely give u an idea about calling java fro ABAP using Jco.
    http://www.thespot4sap.com/Articles/SAP_Netweaver_Java_Connector.asp
    regards,
    aravindh.

  • Should I remove Java from  my IMac?

    Should I remove Java from my iMac?  Heard  of security problem with Java and  wondered if I should delete it,

    MadMacs0 wrote:
    I've been going entirely on the almost universal statement that installing Lion does not install Java by default. I'm very aware of the fact that older versions of OS X actually rely on the use of Java for some system functions, but I've been told that is no longer the case. If that were so, then there is no need for any Java to be present, yet you say it is there and you aren't the only one who has told me that.
    But exactly how much Java is installed by default? Obviously not enough to use it for browsing. In the days of the Java 6 Preferences app, it used to alert you that Java was not installed and offer to do so.  What happens with standalone apps like CrashPlan in Lion that require Java, do they have enough, by default, to run?
    The only Java component missing in these OSs is the Java Runtime Environment (JRE). Peruse those installations, looking in these directories, and be enlightened:
    /Applicatons/Utilities/->Java Preferences.app
    /Library/Java/
    /Library/Internet Plug-Ins/->JavaAppletPlugin.plugin
    /System/Library/CoreServices/->
            Jar Launcher.app
            Java Web Start.app
            JavaVersion.plist
    /System/Library/Frameworks->
            JavaFrameEmbedding.framework
            JavaScriptCore.framework
            JavaVM.framework
    /System/Library/LaunchAgents/->
    com.apple.java.InstallOnDemand.plist
    com.apple.java.updateSharing.plist
    /System/Library/Java
    /System/Library/PrivateFrameworks/->
            JavaApplicationLauncher.framework
            JavaLaunching.framework
    to name a few, but probably not all the Java components installed with OS Xs. Then, stop saying Java's not installed, when only the JRE component is missing.
    There has been speculation from some that perhaps it migrated from an older system or that Lion was installed on top of the older system. There's also some confusion these days about what actually constitutes a "clean install".
    AFAICT, it's speculated wrongly. As for the clean install, I define it to occur when the user wipes the drive, installs the OS, sets up everything, and then installs all 3rd-party software. Then, the installation is clean. If there's any migration involved, then it's not clean. i've not done one for over ten years and my OSs started with 9.2->Jaguar->to the current three.

  • JNI (Java from C) -- multiple JREs installed, need to use non-default one

    Hello,
    I don't know how many Google/forum searches I must have tried -- I can't seem to find a solution to my problem.
    I am calling Java from C. We have two types of environments:
    (1) 1.3/1.4 mix, and
    (2) 1.4 only.
    The mixed environments are configured to use 1.3 by default. This configuration will not be changed. The original developer's code needs backported to the mixed environment, but it has been discovered that his Java code is not 1.3-compatible.
    Since the code is not compatible with 1.3, I need a way to bypass the default JRE setting and get JNI to start a 1.4 JVM. Is there a way to do this?
    Thank you for your help.

    My "solution" is a kludge. It attempts to compensate
    for what I thus far believe to be an apparent lack of
    functionality. I believe the functionality I
    described should exist in JNI so that little jewels
    like my "solution" are not needed. What I am doing
    is improper. Therefore, I respectfully disagree with
    you.Except that your OP suggested that if you could replace it with 1.4 then that would be suitable solution.
    So if that is a suitable solution and you can in fact modify the JNI code then that is a solution that meets all of your needs.
    Regardless however you will note that the "The Java Native Interface" book in chapter 7 provides a specific section which
    1. Specifically points out why you can't depend on a generic VM loading mechanism
    2. Provides a specific mechanism which is OS/Platform specific, for doing runtime loading of the VM presuming certain constraints are followed.

  • Java from Time Machine

    Hi all...
    Due to the recent Java update (From Apple), Java is disabled in web-browsers.
    Simple question is, how do I restore just the old version of Java from a Time Machine backup, without having to do a full restore of all my files?
    Thanks.

    You can't.
    MadMAC0 posted at https://discussions.apple.com/message/20107182?ac_cid=tw123456#20107182 that:
    Apple has posted (10/22/12) the approved solution for restoring the Java 6 plug-in:
    Java for OS X 2012-006: How to re-enable the Apple-provided Java SE 6 applet plug-in and Web Start functionality.

  • Problem in generate Java  from PL SQL package in Jdeveloper

    Hi
    i have problem in create java class from PL SQL package in JDeveloper.
    I use Database navigator of jdeveloper and right click on a package and choose Generate Java then in Jpublisher window choose my view Controller and accept other default values.
    I call methods of generated class in the Action of a button in my JSP page, but when I click the button it  throw null pointer exception !!! i fund one of generated method return null and it lead to this exception.
    protected DefaultContext __tx = null;
    public DefaultContext getConnectionContext() throws SQLException  {
    if (__tx==null){
    __tx = (getConnection()==null) ? DefaultContext.getDefaultContext() : new DefaultContext(getConnection());
        return __tx;
      public Connection getConnection() throws SQLException
        if (__onn!=null) return __onn;
         else if (__tx!=null) return __tx.getConnection();
         else if (__dataSource!=null) __onn= __dataSource.getConnection();
         return __onn;
    i try to generate class in Model project and create DataControl for that and use method action but noting change and i get null pointer again!!
    Jdeveloper Versino = 11.1.1.7.0

    Let me ask you another question: Why do you generate java from the package at all?
    Where do you want to call the package?
    Back to your question: you should see code like
        public void setDataSourceLocation(String dataSourceLocation) throws SQLException {
            javax.sql.DataSource dataSource;
            try {
                Class cls = Class.forName("javax.naming.InitialContext");
                Object ctx = cls.newInstance();
                java.lang.reflect.Method meth = cls.getMethod("lookup", new Class[] { String.class });
                dataSource = (javax.sql.DataSource) meth.invoke(ctx, new Object[] { "java:comp/env/" + dataSourceLocation });
                setDataSource(dataSource);
            } catch (Exception e) {
                throw new java.sql.SQLException("Error initializing DataSource at " + dataSourceLocation + ": " + e.getMessage());
    in the generated code. This code look up a datasource (which you have defined e.g. on the Weblogic Server) by calling the method
    setDataSourceLocaltion("jdbc/HRConnDS");
    This look up the datasource nad stores it in the class variable.
    Timo

  • Upgrade java from 1.2 to 1.5 on SunOS 5.8

    Hi,
    Can anyone help me to upgrade java from 1.2 to 1.5 on SunOS 5.8 ....
    Thanks
    G. Singh

    Can anyone help me to upgrade java from 1.2 to 1.5 on
    SunOS 5.8 ....Sure, download the installation file and run it, then follow instructions. If you need more help, I'd be happy to help for $150 / hour

  • Calling Java from Delphi

    Can ActiveX bridge used for calling Java from Delphi?

    Also trying to solve this problem, after creating the bean i packaged/registered it successfully, (tested the bean using beanbox, works perfectly) then tried calling it via createoleobject in delphi 7
    (*Code Snip *)
    Var
    v : variant;
    begin
    try
    v := createoleobject(Edit1.text); // my class name ie WorldPort.Bean (also tried WorldPort.Bean.1
    except on e:exception do
    showmessage(e.Message)
    end;
    end;
    (*Code Snip*)
    After this simple code failed i started backtracking , eventually after getting "Access Violation...etc in axbridge.dll" all the time. tried delphi "import activex control" got the same access violation.
    Decided to test the example from http://java.sun.com/j2se/1.4.2/docs/guide/beans/axbridge/developerguide/examples.html........ they both crashed on execution (calc.exe and boundprop.exe).
    After this failed I tested these example classes on another machine, both crashed again.....
    Also tried this experiment in VC++ , after adding the class to the Toolbox , i try to drop it onto a form, once again access violation.**PS**
    ('You will need VC++ and the Microsoft SDK to build the dll, download c++beta for free from microsoft site it you need it')** and a simple cmd file todo the job would look something like this:
    echo - ** Build Java ActiveX Bridge **
    echo Make sure these folders exist in jre--> axbridge\lib and axbridge\bin
    cd\SDK\jre\axbridge\bin
    set path=%path%;C:\MSDN\Bin;C:\VisualC++\lib
    echo path
    javac WorldPort.java
    jar cmf Manifest.txt WorldPort.jar WorldPort.class
    "C:\SDK\bin\packager.exe" -clsid {162193C4-AD5C-4A06-9F88-A737AE9B43AD} -out "C:\SDK\jre\axbridge\bin" WorldPort.jar WorldPort-reg
    *** After running this cmd you will find the dll in bin folder and the jar in lib folder..***
    Must Read:http://java.sun.com/j2se/1.4.2/docs/guide/beans/axbridge/developerguide/index.html
    Hope some of this helps , if you have successfully created / installed/ used a "JavaActiveX" in Delphi , i would really like to try replicate it on my machine..

  • ClassDefNotFound error when calling Java from C++

    Hi all,
    I have a problem with calling my java from C++ through JNI.
    I have set my CLASSPATH environment varible that include path to every libary that I need. My source is as follows:
    #include <jni.h>
    #include <stdio.h>
    int main()     
         JNIEnv               *env;
         JavaVM               *jvm;
         JavaVMInitArgs     vm_args;
         jint               res;
         jclass               cls;
         jmethodID          mid;
    IMPORTANT: specify vm_args version # if you use JDK 1.1.2 and beyond
         vm_args.version = JNI_VERSION_1_4;
         vm_args.ignoreUnrecognized = JNI_TRUE;
         JNI_GetDefaultJavaVMInitArgs(&vm_args);
         /* Create the Java VM */
         res = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);
         if (res < 0) {
              printf("Can't create JVM\n");
              return 1;
         cls = (env)->FindClass ("dds/test/comm/listeners/NACKListenerFrame");
         if (cls == 0)     {
              printf("Can't find NACKListenerFrame Class\n");
              return 1;
    mid = (env)->GetStaticMethodID(cls, "start", "()V");
         if (mid == 0)     {
              printf("Can't find NackListnerFrame.start \n");
              return 1;
         (env)->CallStaticVoidMethod((_jclass*)cls, (_jmethodID*)mid, NULL);
         jthrowable e = (env)->ExceptionOccurred();
         if (e)     {
              env->ExceptionDescribe();
              env->ExceptionClear();
         if ((jvm)->DestroyJavaVM() < 0)     {
              printf("Cannot destroy JVM./n");     
         return 0;
    I deliberately left out the codebelow because I want the JVM I created to load Classes from the system's CLASSPATH variable as I have set path to every classes that I need, in that CLASSPATH variable.
    JavaVMOption     options[1];
    options[0].optionString=
    "-Djava.class.path=.;E:/DDSproject/DDSImplementation/classes";
    vm_args.options = options;
    vm_args.nOptions = 1;
    But it seems like unless I specify CLASSPATH in my C++ source code the JVM could not find any classes.
    I tried to put the "jvm.dll" path to the first one in the System's PATH variable. It does not work either...
    Gurus Pls help!!!.. I don't know what to do... I don't wanna code my CLASSPATH in my c++ source code as above.
    Thanks in advance,
    chancellor

    I was thinking JVM should the classpath when it is invoked. But obviously it is not and we need to assign the classpath ourselves when invoking from native side. Thanks for pointing that out. For other people's benefit the following is the code piece I for initializing JVM.
    char* str1;
              char* str2;
              char* classpath;
              str1 = "-Djava.class.path=";
              str2 = std::getenv("CLASSPATH");
              classpath = (char*)malloc(strlen(str1) + strlen(str2) + 1);
              strcpy(classpath, str1);
              strcat(classpath, str2);
              if (str2 == NULL)     {
                   printf("CLASSPATH environment variable is not defined.");
                   exit(1);
              m_VmArgs.version = JNI_VERSION_1_4;
              m_options[0].optionString= classpath;
              m_VmArgs.options = m_options;
              m_VmArgs.nOptions = 1;
              m_VmArgs.ignoreUnrecognized = JNI_TRUE;
              JNI_GetDefaultJavaVMInitArgs(&m_VmArgs);
              /* Create the Java VM */
              m_Res = JNI_CreateJavaVM(&m_Jvm, (void**)&m_Env, &m_VmArgs);
              if (m_Res < 0) {
                   printf("Can't create JVM\n");
                   exit(1);
    thanks,
    chancellor

  • How to call procedure in Java from SQL Server Database

    Hello Every Body
    i Have Question about
    How to call procedure in Java from SQL Server Database
    Thanks

    Hi,
    have you tried a Google search? I just gave it a 3 second try and already found: http://stackoverflow.com/questions/6113674/how-do-i-execute-a-ms-sql-server-stored-procedure-in-java-jsp-returning-table-d
    Frank

  • How to run Java from Firefox Extension using liveconnect?!

    Hi, I'm trying to run a very simple java program from a Firefox extension I'm making but I've run into a brickwall and just can't get it to work. I'm a complete beginner in java and don't know much javascript so I've copied and pasted code from around the net to get where I am now. I'm sure I'm just making some stupid error at some step.
    In order to work out what I'm misunderstanding/doing wrong I'd be really grateful if someone could show me how to get it to work using a very basic example:
    Say I have a .java file taken from the sun pages:
    * The HelloWorldApp class implements an application that
    * simply displays "Hello World!" to the standard output.
    class HelloWorldApp {
        public static void main(String[] args) {
            System.out.println("Hello World!"); //Display the string.
    }So I stick it into a jar using:
    jar.exe cvfe HelloWorldApp.jar HelloWorldApp.class HelloWorldApp.class
    I then place it directly on my C: drive.
    In the javascript of my firefox extension I have code copied and pasted from https://developer.mozilla.org/en/Java_in_Firefox_Extensions:
    var urlClasz = java.lang.Class.forName("java.net.URL");
    var urlArray = java.lang.reflect.Array.newInstance(urlClasz,1);
    urlArray[0] = new java.net.URL('file:///C:/HelloWorldApp.jar');
    var cl = java.net.URLClassLoader.newInstance(urlArray);
    var aClass = java.lang.Class.forName("HelloWorldApp", true, cl);
    var aStaticMethod = aClass.getMethod("HelloWorldApp", []);
    var greeting = aStaticMethod.invoke(null, []);This seems to start java but then only gives me the error:
    "Error: uncaught exception: Error calling method on NPObject! [plugin exception: java.lang.ClassNotFoundException: HelloWorldApp]."
    I would be infinitely grateful if someone could show me the code I would use in this situation to run the HelloWorldApp. If I could get it working in this basic situation I'm sure I could work it out from there.
    Thank you very, very much!!

    By the way, I answered just because nobody did and I have some experience with using java from mozilla javascript.
    But I never played with Firefox extensions.
    No problem baftos, I understand you might not have all the answers but you've helped loads so far, so thanks a lot! I've found it very difficult to find good documentation on this for a beginner like me.
    Adding public did it (although I thought that I'd tried that, oops) so thanks again for that. I may have a couple of other questions just in case you happen to know the answer!
    I'd like to send some string arguments to the method I really want to run eg:
    public class HelloWorldApp {
    public static void sayHello(String[] args)
    {code}After googling .forName and .getMethod to see how to pass parameters I've added some code:
    {code:java}
    var strClass = java.lang.Class.forName("java.lang.String");
    var parameters = java.lang.reflect.Array.newInstance(strClass,2);
    parameters[0] ="My string argument";
    parameters[1] ="3"; // etc...
    var argHolder = java.lang.reflect.Array.newInstance(strClass,1);
    argHolder[0] = strClass;
    var aClass = java.lang.Class.forName("HelloWorldApp", true, cl);
    var aStaticMethod = aClass.getMethod("sayHello", argHolder);
    var greeting = aStaticMethod.invoke(null, parameters);
    {code}What I thought I was doing was creating a java array: argHolder and putting the string class/object thingy?! in it so that getMethod would look for a method called "sayHello" which took a string array as an argument... but apparently not!
    This brings me back to square one with a cannot find method with these arguments error:
    "Error: uncaught exception: Error calling method on NPObject! [plugin exception: java.lang.IllegalArgumentException: No method found matching name getMethod and arguments [java.lang.String, [Ljava.lang.String;]]."
    You don't happen to know how to do this as well do you?!
    Edited by: mzatanoskas on Feb 13, 2009 1:40 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to set JRE 1.5.0_07 as default Java from the cmd line in Windows

    Hi All,
    We are currently in the process of upgrading our company to IE8. As MS JVM is incompatible we need to remove it.
    However, once we have done this JRE 1.5.0_07 is not the default version of Java any more for IE8.
    My question is - Is there a command line switch to set set JRE 1.5.0_07 as default Java from the cmd line in Windows. ie the setting in Java Control panel where you would tick Internet Explorer?
    Thanks in advance!

    This is to confirm a similar issue. Here is the scenario:
    We are currently using IE 6 and looking forward to upgrade to IE 8. Our current Java version is: J2RE 1.5.0_16.
    When updating from IE 6 to IE 8 with J2RE 1.5.0_16 on a test workstation, we get the following error from the Java testing website (http://www.java.com/en/download/help/testvm.xml): "load: class testvm2/Main.class not found."
    Workaround :
    -> Change Java JRE Network Settings in Control Panel to "User proxy server : xxx.xxx.xxx.xxx:xx"
    We are using an autoconfig.pac file and it seems IE8 can't parse the settings to JRE to go through the proxy.
    Please advise if you have a fix for the autoconfig.pac file.

Maybe you are looking for

  • Posting with transaction type 160 is not possible at MR8M

    MODERATOR:  Do not post (or request) email address or links to copyrighted or confidential information on these forums.  If you do, the thread will be LOCKED and all points UNASSIGNED.  If you have some information, please consider posting it to the

  • Use FM SD_SALESDOCUMENT_CREATE for creating free goods line items

    Dear Experts, I have created a program for uploading Sales Order details using FM "SD_SALESDOCUMENT_CREATE". The program successfully creates Sales Orders. Now the problem is with the materials which is a free goods item. i.e. if I enter a material s

  • Oracle 10g Migration Workbench 10.1.0.4.0

    Hai, Could any of you explain me about Oracle 10g Migration Workbench 10.1.0.4.0 product and also about the features and usage of this project. Thanks in advance. A.Mohammed Rafi.

  • Getting 404 error when trying to create a powerview report from a BISM (SharePoint 2013)

    When clicking on the BISM file, I would get a 404 FILE NOT FOUND.   But when I go through the menu of the BISM file and click on Create Power View Report, it will works, but not when i left click on the file. Please help. Thank you.

  • What happens after you hit "publish"?

    Finished my site and got all the set up done to use ftp to publish to charter.net. After I hit the publish button it grayed out. Is there suppose to be a progress bar or any indication it is actually working? Waited 4 hours last night and publish but