• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Add a jar file for a Java Stored Procedure

 
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,

I am developing a java stored procedure and i want to load it into oracle using the loadjava command line, however inside the method of the procedure I use some classes that are obrained from a jar file, how can I include the .jar file into the class-path of oracle ??

in addition one of the arguments of the java method is ResultSet do you know to which oracle type it should be mapped, or if there is any other alternatives for using the ResultSet ??


for example:

1) in pl/sql i do a select into statement and put the data in an appropriate type.
2) then i want to call my Java Stored Procedure passing it the data i retrieved, ( which should be mapped to a ResultSet in Java or something else don't know).
3) finally in the Java Stored Procedure I handle the data i received.

for now the only workaround is that i don't pass the data, i just pass a String containing the Query to execute, and i create a PreparedStatment in my Java Stored Procedure and execute this query, and obtain the ResultSet from it, however i think its not very good.

I have read around how to return a ResultSet from a Java Stored Procedure, but nothing talking about how to pass it as an argument, I have seen that the java.sql.Array interface has a method getResultSet, but I didn't understand how i could put the result of a select query into an object of type ARRAY or VARRAY

any help would be appreciated. Thanks.
p.s. I am using Oracle 10g, and Java 1.4
 
Omar Al Kababji
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok for the jars it was simple i just used the same command loadjava to load the needed jar files. however i am still blocked with the REF CURSOR --> ResultSet mapping, which is needed as a method parameters.

 
Ranch Hand
Posts: 188
IntelliJ IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I was just trying to use a external jar in my java stored procedure, can you just let me know the exact steps you followed like where did you keep the jar ?

Which loadjava command did you use , the one I see most easily available on the net is



is this the correct one ?

Thanks
Sudarshan
 
Omar Al Kababji
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes its the same.
 
Your mind is under my control .... your will is now mine .... read this tiny ad
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic