Calling java from pl/sql in oracle 10g?its very urgent.

Hi Friends,
i hve simple java code:
class Hell
public static String Hello()
return"hello world";
& compile this code using javac & loaded Hell.class in to database using this command
c:\>loadjava -user chandru/shekar@pulser c:\Hell.class
& i wrote pl/sql like:
CREATE OR REPLACE FUNCTION Hell RETURN String as language java name 'Hell.Hello() return java.lang.String';
i will compile the code & run but at that time this error i am getting:
ORA-29516: Aurora assertion failure: Assertion failure at eox.c:317
Uncaught exception System error: java/lang/UnsupportedClassVersionError
I am using oracle 10g.Plzzzzzzzzz help me.Its very important to for me.
Is any path i hve to set for oracle 10g database.Plz any one help me.
regards
shekar

Hello here is how I solved the problem
Let us assume that i try to load the file Hello.Java into the user scott.
public class Hello {
     public static String world() {
          return "hello world";
1) Dropjava          
You must drop the java class if you already have loaded the class onto the server.
dropjava -u scott/tiger Hello.class
2) load class on server and let the server compile the source code.
It is necessary to compile the source code on the server when the server and the local machine have different Java versions. To check which Java version there is running on the client machine open a command prompt and write Java -version
loadjava -user scott/tiger -resolve Hello.java
3) Publish stored procedure      
sqlplus scott/tiger@oracle
CREATE OR REPLACE FUNCTION helloworld RETURN VARCHAR2 AS                LANGUAGE JAVA NAME 'Hello.world () return java.lang.String';
4)Call stored procedure      
VARIABLE myString VARCHAR2(20);
CALL helloworld() INTO :myString;
PRINT myString;
RGDS
Thomas Winterberg

Similar Messages

  • Advantages and Disadvantages of calling java from PL/SQL

    Hi,
    I have one doubt. What are all the advantages and disadvantages of the calling java from PL/SQL?
    In actual scenario the java program will be in the Application server side. It will do the operation and it will store the result in Data base. But in this case (calling java from PL/SQL), we are loading the java program in the Data base and it is doing the operations.
    I have seen many posts are coming regarding loading jar files into the database. Actually the jar will deploy in to Application server. Is there any difference instead of keeping in the Application server side?
    Then I have read,
    advantages:
    -> java having lot API's. so PL/SQL can use that API's.
    -> if we can not do anything in PL/SQL. we can do it using this mtd(calling java from PL/SQL).
    My questions:
    -> could you explain what are all the things we can not do but we can do using "calling java from PL/SQL" method?
    -> is there any other advantages?
    Disadvantages:
    -> the performance is very slow in calling java from PL/SQL.
    My questions:
    -> Then why others are loading java files and jar files into database?
    -> is there any other disadvantages?
    Could you explain about this one? It will be more helpful to others also…
    Regards,
    kk

    Hi,
    You can read the free first chapter of my book @ http://www.amazon.com/gp/product/1555583296/ (see details then Excerpt)
    Kuassi http://db360.blogspot.com

  • Advantages of calling java from PL/SQL

    Hi experts,
    Could any one tell me the advantages of calling java program from PL/SQL?
    Regards,
    karthi

    Hi,
    You can read the free first chapter of my book @ http://www.amazon.com/gp/product/1555583296/ (see details then Excerpt)
    Kuassi http://db360.blogspot.com

  • Using sockets with java from PL/SQL in Oracle 8.1.7 DBA

    Hey all,
    I've been struggling for a couple of weeks now with a problem. I wrote a framework around a toolkit which makes socket connections to another server. I am attempting to use the framework from within a PL/SQL script, which is calling the framework class files which have been loaded into Oracle 8.1.7 database. The problem seems to be if I grant all permissions, or socket permissions for all hosts/ports, or even the ones I know about are being used, I get a hang when trying to connect. The funny thing is, using the toolkit, if I invoke their classes directly within code written from Oracle's code editor, it will work.
    I suspect there is
    a) Some hidden permission issue
    b) A bug in the sockets implementation Oracle is using for their JVM.
    Can anyone offer insight to this problem?
    Thanks,
    Dave Blake
    [email protected]

    Hello,
    I'm trying to investigate the same thing.
    I want to make a soap-client with PL/SQL with 8i 8.1.6.0.0
    Did you succeed some additional information ??
    I tried to run the following example:
    http://www.oracle.com/technology/tech/webservices/htdocs/samples/dbwebservice/DBWebServices_PLSQL.html
    but it only works with 9i.
    With 8i the errors encountered were : XMLTYPE undefined
    Perhaps if we find the definition of XMLTYPE and we process it to 8i we'll be able to run the example ??
    thank's

  • Calling JAVA from PL/SQL

    Hello,
    Are there any PL/SQL code examples on how to call a JAVA program from a when-button-pressed trigger event?
    Thanks much.

    Hi,
    I was able to import the JAVA code via the "Import Java Classes". Now, what PL/SQL statements do I put in my "when-button-pressed" trigger to execute this JAVA code? Any samples around, preferably with examples of parameter passing.
    Thanks in advance!!

  • URGENT - Call java from pl/sql

    Hi,
    How Can I call external java class in a pl/Sql ??
    Regards
    Giordano

    Hi
    a way to do that, is to load the external java class in your database, like that (ORACLE_SID is setting):
    loadjava -user myuser/mypassword /mypathname/myPackage.class
    Then, you must declare this external procedure like that,
    (for example)
    CREATE OR REPLACE PROCEDURE p_jMyProcedure (Param in varchar2) AS LANGUAGE JAVA NAME 'myPackage.myProcedure(java.lang.String)';
    you can call your procedure as a pl/sql procedure
    so long;

  • Calling Java from PL/SQL truncates long

    We are using Oracle 8.1.6 on Sun.
    We have a table with a field defined as type Long.
    When a record is inserted into the table, a trigger fires a java stored procedure.
    The stored proc takes the provided long and attempts to pass it to a RMI call.
    The long is passed as a java.lang.string.
    However, the class that is invoked through RMI received a NULL value.
    null

    Is the same problem happening for a small String value also?
    i.e stroing the a short value in the long column also causing the same problem.
    Will it be possible to give us some kind of test case (code) or you can give us the exact steps to reproduce the problem.
    null

  • Call php from PL/SQL

    Hello !
    i want to call PHP from PL/SQL(procedure).
    Is it possible .
    If yes then how.
    if no then is there any other way to do it.
    Regards
    null

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Michael Kleiser ([email protected]):
    Look at this: http://www.oracle.com/oramag/code/tips2001/index.html?021201.html
    It`s a java-function which calls a os-command.
    I haven4t testet it.
    In this forum http://www.dbasupport.com/forums/showthread.php?threadid=3703
    someone asked the same question as you.
    I hope this helps you.<HR></BLOCKQUOTE>
    I've tried the tip above without success. Has anyone got it to work?
    null

  • OLAP data from MS SQL to Oracle

    Hi,
    I am currently using Microsoft SQL server 2000 as our datawarehouse with Analytic services(OLAP data).
    We are thinking of migrating to Oracle 10g. By using Migration Workbench, will it migrate my 3 dimensional data(OLAP) from MS SQL to Oracle (OLAP) ?
    Thank you.
    Best Regards,
    Ian Ho

    This could happen if you are using improper LKM
    So depending on your source and staging database you choose the corresponding LKM
    for example:
    If you are using MS SQL Server as your source and Oracle database as the staging database, then you should be using lKM SQL to Oracle

  • Our Java application is built with java 1.4 version and oracle 10g

    Our Java application is built with java 1.4 version and oracle 10g version database, is it possible to upgrade oracle database to 11g?

    is it possible to upgrade
    Yes. SE and the other editions have a migration/upgrade utility, not seeing any mention of that program in the XE license docs. To upgrade to 11gR2 from 10g, the 10g instance must be at patch 10.2.0.2 or higher.
    So if you're a GUI dba, might be out of luck. But the the XE install has the catalog upgrade scripts that need to be run, there is a MOS note explaining the manual upgrade steps.
    Or set up a brand new 11g database instance and datapump your user schema(s) from the 10g instance to the new 11g instance. The database doesn't care what java version you're using, it just does what its told with the data. DDL, DCL, DML ... its not much different. Quite a few new features in 11g.
    But if you're after JVMs that piece is not supported with XE.

  • Problem calling java from vb via activex bridge

    I am trying to call java from vb via ActiveX Bridge and I am running into problems. I would appreciate any help.
    I am using Visual Basic 2010 express, and Java JDK 1.6.0_16. I have used the http://download.oracle.com/javase/1.4.2/docs/guide/beans/axbridge/developerguide/index.html page as a guideline. To try to make it work I took the following steps:
    1. Wrote a very simple java class (below):
    package xxx;
    import java.io.Serializable;
    public class axb implements Serializable {
    public int get_axb_Handle() {
    int Address = 12345678;
    return Address;
    2. After I compiled, and created the jar file. I built the dll using the following command:
    "C:\Program Files\Java\jdk1.6.0_16\bin\packager" -out "C:\Program Files\Java\jdk1.6.0_16\jre\axbridge\bin" E:\axb\dist\axb.jar xxx.axb
    3. I then registered using: regsvr32 axb.dll
    4. In Visual Basic Express IDE I use Project -> Add Reference to add Iterop.axb (dump below), and axb namespace
    5. In my basic code I use the following lines
    Dim axb1 As axb.axb
    axb1 = New axb.axb <== Crash here with AccessViolationException ( full exception below)
    What am I missing? Any help would be greatly appreciated
    Thanks
    Iterop.axb partial dump
    ___[MOD] C:\Documents and Settings\Elie A. Cohen.USINC022\My Documents\Visual Studio 2010\Projects\Repo API Example\Repo API Example\obj\x86\Release\Interop.axb.dll
    | M A N I F E S T
    |___[NSP] axb
    | |___[INT] axb.axb
    | | | .class interface public abstract auto ansi import /*02000006*/
    | | | implements axb.axbDispatch/*02000003*/
    | | | implements axb.axbSource_Event/*02000005*/
    | | | .custom /*0C000018:0A000001*/ instance void [mscorlib/*23000001*/]System.Runtime.InteropServices.GuidAttribute/*01000002*/::.ctor(string) /* 0A000001 */ = ( 01 00 24 34 45 36 44 30 44 41 38 2D 36 41 45 44 // ..$4E6D0DA8-6AED ...
    | | | .custom /*0C000019:0A000007*/ instance void [mscorlib/*23000001*/]System.Runtime.InteropServices.CoClassAttribute/*01000009*/::.ctor(class [mscorlib/*23000001*/]System.Type/*01000007*/) /* 0A000007 */ = ( 01 00 0C 61 78 62 2E 61 78 62 43 6C 61 73 73 00 // ...axb.axbClass. ...
    | |
    | |___[CLS] axb.axbClass
    | | | .class public auto ansi import /*02000004*/
    | | | implements axb.axbDispatch/*02000003*/
    | | | implements axb.axb/*02000006*/
    | | | implements axb.axbSource_Event/*02000005*/
    | | | .custom /*0C00000F:0A000008*/ instance void [mscorlib/*23000001*/]System.Runtime.InteropServices.ClassInterfaceAttribute/*0100000A*/::.ctor(int16) /* 0A000008 */ = ( 01 00 00 00 00 00 ) ...
    | | | .custom /*0C000010:0A000009*/ instance void [mscorlib/*23000001*/]System.Runtime.InteropServices.ComSourceInterfacesAttribute/*0100000B*/::.ctor(string) /* 0A000009 */ = ( 01 00 0F 61 78 62 2E 61 78 62 53 6F 75 72 63 65 // ...axb.axbSource ...
    | | | .custom /*0C000011:0A000001*/ instance void [mscorlib/*23000001*/]System.Runtime.InteropServices.GuidAttribute/*01000002*/::.ctor(string) /* 0A000001 */ = ( 01 00 24 43 44 42 46 36 42 33 33 2D 45 32 33 46 // ..$CDBF6B33-E23F ...
    | | | .custom /*0C000012:0A000002*/ instance void [mscorlib/*23000001*/]System.Runtime.InteropServices.TypeLibTypeAttribute/*01000003*/::.ctor(int16) /* 0A000002 */ = ( 01 00 02 00 00 00 ) ...
    | | |___[MET] method .ctor : void()
    | | |___[MET] method equals : bool(object)
    | | |___[MET] method getClass : object()
    | | |___[MET] method get_axb_Handle : int32()
    | | |___[MET] method hashCode : int32()
    | | |___[MET] method notify : void()
    | | |___[MET] method notifyAll : void()
    | | |___[MET] method toString : string()
    | | |___[MET] method wait : object(object,object)
    AccessViolationException exception
    System.AccessViolationException was unhandled
    Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
    Source=mscorlib
    StackTrace:
    at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
    at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)
    at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)
    at System.Activator.CreateInstance(Type type, Boolean nonPublic)
    at System.Activator.CreateInstance(Type type)
    at WindowsApplication1.Form1.getPatientHandle_Click(Object sender, EventArgs e) in C:\Documents and Settings\Elie A. Cohen.USINC022\my documents\visual studio 2010\Projects\Repo API Example\Repo API Example\Repo API Example.vb:line 13
    at System.Windows.Forms.Control.OnClick(EventArgs e)
    at System.Windows.Forms.Button.OnClick(EventArgs e)
    at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
    at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
    at System.Windows.Forms.Control.WndProc(Message& m)
    at System.Windows.Forms.ButtonBase.WndProc(Message& m)
    at System.Windows.Forms.Button.WndProc(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
    at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
    at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
    at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
    at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
    at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
    at System.Windows.Forms.Application.Run(ApplicationContext context)
    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
    at WindowsApplication1.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
    at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
    at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
    at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
    at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Threading.ThreadHelper.ThreadStart()
    InnerException:

    In case you haven't figured it out already... Or if anyone else is curious... Or for myself when I get old and forgetful...
    h2. Object Creation
    For starters, when you create an ActiveX object from within VB, use:
    Set myObject = CreateObject("JavaObject.Bean")When I refer to JavaObject.Bean, I'm meaning the full object name + ".Bean". So, in your case, you should use:
    Set myObject = CreateObject("xxx.axb.Bean")h2. Location
    The .dll file must be located in the JRE that is used at the time of calling. Meaning, the .dll file must be placed under <jre_home>\axbridge\bin and registered there.
    In your case:
    DLL:
    C:\Program Files\Java\jre6\axbridge\bin
    Jar:
    C:\Program Files\Java\jre6\axbridge\libh4. A Note:
    The only supported JRE is a 32bit version as far as I know with regards to the ActiveX bridge. Just like the packager.exe can only be found in the 32bit JDK.
    h2. Methods
    h3. Object Types
    ActiveX Bridge does not support passing literals or arrays. However, it does support passing java's primitive data types as Objects.
    Simply meaning:
    h4. Invalid:
    public int get_axb_Handle() {
         int Address = 12345678;
         return Address;
    }h4. Valid:
    public Integer get_axb_Handle() {
         int Address = 12345678;
         return Address;
    }On a normal circumstance, there's little difference between the two methods. However, in the second example, the JVM does a typecast from a literal data type to a object data type, resulting in a valid object to pass through to Visual Basic. Now, obviously there are multiple ways to do a proper change, new Integer(int) for example. It doesn't matter to me. At the end of the day, you have to pass an object.
    As a side note, the same idea applies when receiving data from Visual Basic.
    h4. Invalid:
    public void set_axb_Handle(int newHandle) {
         int Address = newHandle;
    }h4. Valid:
    public void set_axb_Handle(Integer newHandle) {
         int Address =newHandle;

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

  • Shortcut to find a property from property pallate in oracle 10G forms

    Hi,
    I want to know the the shortcut to find a property from property pallete in oracle 10G form builder.
    Because i cannot use mouse due to blindness. Please tell shortcut to locate a property from property pallete.
    Qasim Javaid Malik

    Hi,
    Yes, the keys I mentioned open Property Palette.
    I have no clue about short-cuts for properties in an open palette.
    The Up and Down arrow keys work will you enter a LoV, and I could not figure out key strokes to come out of the LoV !
    Maybe someone else has some idea of this.
    Cheers,
    PS: I was trying on 11g R1 as I do not have 10g any more.
    Edited by: Prabodh on Sep 14, 2012 2:53 PM

  • Learning PL/SQL in Oracle 10G XE

    Successfully installed Oracle 10G XE on my desktop. I'm a newbie Oracle user who wants to learn PL/SQL through Oracle 10G XE.
    Is this possible? Hope you can give me tips and advice on how I would start with this?
    Thanks!

    Certainly possible. I would suggest you crack open the PL/SQL Users Guide. DO you have previous programming experience? If so, looks at the examples.

  • Help me please to migrate from MS SQL to Oracle

    Hi all,
    we are in process of migration from MS SQL to Oracle.
    Please help me to perform the same in Oracle:
    select number+1 as rowid,number*6+1 as rowbeg,number*6+6 as rowend 
    from master.dbo.spt_values
    where type='P'
    Our Oracle version:
    select * from v$version
    BANNER                                                                         
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production   
    PL/SQL Release 11.2.0.2.0 - Production                                         
    CORE 11.2.0.2.0 Production                                                     
    TNS for 64-bit Windows: Version 11.2.0.2.0 - Production                        
    NLSRTL Version 11.2.0.2.0 - Production                                         
    5 rows selected.

    996831 wrote:
    Here is another solution without "connect by":
    select 1 as rnum, 1 as rowbeg, 6 as rowend from dual
    union all
    select rownum+1 as rnum,rownum*6+1 as rowbeg,rownum*6+6 as rowend
    from all_objects
    1
    1
    6
    2
    7
    12
    3
    13
    18
    4
    19
    24
    5
    25
    30
    6
    31
    36
    7
    37
    42
    (et cetera).
    This needs the user to have access on all_objects view and it will limit the result upto the numbers of objects returned by the all_objects view.

Maybe you are looking for