Using a OracleOCIConnection object in a Java Stored Procedure
Hi,
I'm trying to use a OracleOCIConnection in a Java Stored Procedure, but the JVM seems to be 1.3, so it doesn't support this object, how can I update the JVM to 1.4 or just load the necessary classes? I tried to load the ojdbc14.jar to the system's schema but the user needs a LoadClassInPackage permission, and I confess it scared me..
Were u I look for the ofg---.pll.
I can't find it my system
--kalpana
Similar Messages
-
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();
nullSounds like your C2 REF TYP1 attribute may be null. Unfortunately you neglected to say where in your code the NullPointerException occurs.
-
Returning a serializable object from a java stored procedure
[Server : Oracle 8.1.6 on WinNT4 server. Client : java 1.2.2 on WinNT4 workstation.]
I am attempting to use a java stored procedure to build a complex serializable java object on the database (to minimise number of requests/queries on the network) and then return this object in response to the original query.
I have it writing a BLOB by means of
OutputStream os = retval.getBinaryOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(os);
oos.writeObject(v);
return retval;
where retval is a blob selected from a dummy table (created for this purpose) and v is a vector containing only serializable objects.
However, on the client side when I attempt to recover the object by
OracleResultSet rs = (OracleResultSet)stmt.executeQuery("SELECT javatest FROM DUAL");
oracle.sql.BLOB blob=rs.getBLOB(1);
InputStream inp = blob.getBinaryStream();
ObjectInputStream oinp = new ObjectInputStream(inp);
Vector retval = (Vector)oinp.readObject();
I get an exception telling me that the input stream does not contain an object at the line containing new ObjectInputStream(inp);
The full exception is :
java.io.StreamCorruptedException: InputStream does not contain a serialized object
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:731)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:165)
at eRespond.DBLayer.JavaStoredProcedures.testdbobj.test2(testdbobj.java:143)
at eRespond.DBLayer.JavaStoredProcedures.testdbobj.main(testdbobj.java, Compiled Code)
I've checked that the returned blob is non-null, and that oracle.sql.BLOB is used throughout.
Any thoughts?
Thanks,
mark.Firstly I guess to be able to new B() as a Thread, B
should extends Thread.
Secondly the constructor should not have any return
type:
public B(String cmd)
instead of
public void B(String cmd)
Lastly there is no need to override the start() method
if all it does is to call the superclass. The subclass
automatically inherits the method.
Hope this helps.thanks for replying so soon...
yes, you are right, it should extends Thread and it is, i forgot to out in this example... my mistake!
i'll try the construnctor thing to see if it works. bare in mind that i working with java stored procedures, it should work even so, right?
thanks -
Calling XML API's from Java Stored Procedures in DB
Hi,
I am have and Oracle 10gR2 db installed and XML Publisher Enterprise Server 5.6.2.
I have created the following Java Class and used loadjava to make it a Java Stored Procedure:
<code>
import java.io.IOException;
import java.lang.Object;
import oracle.apps.xdo.XDOException;
import oracle.apps.xdo.template.FOProcessor;
import oracle.apps.xdo.template.RTFProcessor;
public class callingXMLP{
public static String rtfToXsl(String rtfFile, String xslFile)
try {
RTFProcessor rtfProcessor = new RTFProcessor(rtfFile); //Input RTF
rtfProcessor.setOutput(xslFile);
rtfProcessor.process();
} catch (IOException IOE) {
return" Error "+IOE.getMessage();}
catch(XDOException XDE ){
return" Error "+XDE.getMessage();
return "Success";
public static String mergeXmlXsl(String xmlFile, String xslFile, String outputFile)
FOProcessor processor = new FOProcessor();
processor.setData(xmlFile); //Input XML File
processor.setTemplate(xslFile); //Input XSL File
processor.setOutput(outputFile); //Ouput File
processor.setOutputFormat(FOProcessor.FORMAT_PDF);
//start processing
try {
processor.generate();
catch (XDOException e){
e.printStackTrace();
//System.exit(1);
return "Error - "+e.getMessage();
//System.exit(0);
return "Success";
</code>
I then wrap this using the following function spec in pl/sql:
create or replace function callXMLP(input1 VARCHAR2, output1 VARCHAR2) RETURN VARCHAR2
as language java name 'callingXMLP.rtfToXsl(java.lang.String,java.lang.String) return java.lang.String';
and
create or replace function mergeXMLXSL(xml VARCHAR2, xsl VARCHAR2, output VARCHAR2) RETURN VARCHAR2
as language java name 'callingXMLP.mergeXmlXsl(java.lang.String,java.lang.String,java.lang.String) return java.lang.String';
Calling the callXMLP function works fine, and produces an XSL file from the input RTF file as expected.
When I run the mergeXMLXSL function, it says that the function has completed successfully, but it seems to be throwing an XDOException error as it is returning "Error - null" message from the Java.
A PDF document is being created, but it does not have any content. I have also modified the Java to create an RTF instead, but still the same thing happens.
Is there anything that I need to check, or something that I am missing when trying to create the final PDF document?
Please help, I am completely stuck with this now.
Many Thanks,
CjHello Chris,
I have been able to create a PDF from the database. I loaded the following jar files and removed any java class that could not compile.
activation.jar, axis-ant.jar, axis.jar, axis-schema.jar, bicmn.jar, bipres.jar, collections.jar,
commons-beanutils.jar, commons-collections-3.1.jar, commons-collections.jar, commons-dbcp-1.1.jar commons-digester.jar, commons-discovery.jar, commons-el.jar, commons-fileupload.jar, commons-logging-api.jar commons-logging.jar, commons-pool-1.1.jar, http_client.jar, i18nAPI_v3.jar, javamail.jar, jaxrpc.jar,
jewt4.jar, jsp-el-api.jar, log4j-1.2.8.jar, logkit-1.2.jar, ojpse.jar, oracle-el.jar, oraclepki.jar,
orai18n.jar, quartz-1.5.1.jar, quartz-oracle-1.5.1.jar, regexp.jar, saaj.jar, service-gateway.jar, share.jar, uix2.jar, uix2tags.jar, versioninfo.jar, wsdl4j.jar, xdocore.jar, xdoparser.jar, xdo-server-delivery-1.0-SNAPSHOT.jar, xdo-server-kernel-0.1.jar, xdo-server-kernel-impl-0.1.jar, xdo-server-scheduling-1.0-SNAPSHOT.jar, xercesImpl.jar, xmlparserv2-904.jar, xmlpserver.jar, xsu12.jar
I needed to copy the XML Publisher fonts to the database server and ran the following java grants, note my $ORACLE_HOME is /opt/app/oracle/product/10.1.0/
dbms_java.grant_permission('XMLP', 'java.util.PropertyPermission', '*', 'read,write');
dbms_java.grant_permission('XMLP', 'java.net.SocketPermission', '*', 'connect, resolve');
dbms_java.grant_permission('XMLP', 'java.io.FilePermission', '/tmp/*', 'read, write, delete');
dbms_java.grant_permission('XMLP', 'java.io.FilePermission', '/opt/app/oracle/product/10.1.0/javavm/lib/*', 'read');
dbms_java.grant_permission('XMLP', 'java.io.FilePermission', '/opt/app/oracle/product/10.1.0/javavm/lib/fonts/*', 'read');
dbms_java.grant_permission('XMLP', 'java.lang.RuntimePermission', 'setFactory', '');
George -
Passing Tables back from Java Stored Procedures
Thomas Kyte has written (in reference to
trying to pass an array back from a stored
function call):
You can do one of two things (and both require the use of
objects). You cannot use PLSQL table types as JDBC cannot bind to
this type -- we must use OBJECT Types.
[snip]
Another way is to use a result set and "select * from
plsql_function". It could look like this:
ops$tkyte@8i> create or replace type myTableType as table of
varchar2 (64);
2 /
Type created.
ops$tkyte@8i>
ops$tkyte@8i>
ops$tkyte@8i> create or replace
2 function demo_proc2( p_rows_to_make_up in number )
3 return myTableType
4 as
5 l_data myTableType := myTableType();
6 begin
7 for i in 1 .. p_rows_to_make_up
8 loop
9 l_data.extend;
10 l_data(i) := 'Made up row ' | | i;
11 end loop;
12 return l_data;
13 end;
14 /
Function created.
ops$tkyte@8i>
ops$tkyte@8i> select *
2 from the ( select cast( demo_proc2(5) as mytableType )
3 from dual );
COLUMN_VALUE
Made up row 1
Made up row 2
Made up row 3
Made up row 4 [Image]
Made up row 5
So, your JDBC program would just run the query to get the data.
If the function "demo_proc2" cannot be called from SQL for
whatever reason (eg: it calls an impure function in another piece
of code or it itself tries to modify the database via an insert
or whatever), you'll just make a package like:
ops$tkyte@8i> create or replace package my_pkg
2 as
3
4 procedure Make_up_the_data( p_rows_to_make_up in
number ); 5 function Get_The_Data return myTableType;
6 end;
7 /
Package created.
ops$tkyte@8i>
ops$tkyte@8i> create or replace package body my_pkg
2 as
3
4 g_data myTableType;
5
6 procedure Make_up_the_data( p_rows_to_make_up in number )
7 as
8 begin
9 g_data := myTableType();
10 for i in 1 .. p_rows_to_make_up
11 loop
12 g_data.extend;
13 g_data(i) := 'Made up row ' | | i;
14 end loop;
15 end;
16
17
18 function get_the_data return myTableType
19 is
20 begin
21 return g_data;
22 end;
23
24 end;
25 /
Package body created.
ops$tkyte@8i>
ops$tkyte@8i> exec my_pkg.make_up_the_data( 3 );
PL/SQL procedure successfully completed.
ops$tkyte@8i>
ops$tkyte@8i> select *
2 from the ( select cast( my_pkg.get_the_data as mytableType
) 3 from dual );
COLUMN_VALUE
Made up row 1
Made up row 2
Made up row 3
And you'll call the procedure followed by a query to get the
data...
I have tried this, and it works perfectly.
My question, is what does the wrapper look
like if the stored function is written
in java instead of PL/SQL? My experiments
with putting the function in java have been
dismal failures. (I supposed I should also
ask how the java stored procedure might
look also, as I suppose that could be where
I have been having a problem)
nullThanks for the response Avi, but I think I need to clarify my question. The articles referenced in your link tended to describe using PL/SQL ref cursors in Java stored procedures and also the desire to pass ref cursors from Java to PL/SQL programs. Unfortunately, what I am looking to do is the opposite.
We currently have several Java stored procedures that are accessed via select statements that have become a performance bottleneck in our system. Originally the business requirements were such that only a small number of rows were ever selected and passed into the Java stored procedures. Well, business requirements have changed and now thousands and potentially tens of thousands of rows can be passed in. We benchmarked Java stored procedures vs. PL/SQL stored procedures being accessed via a select statement and PL/SQL had far better performance and scaleable. So, our thought is by decouple the persistence logic into PL/SQL and keeping the business logic in Java stored procedures we can increase performance without having to do a major rewrite of the existing code. This leads to the current problem.
What we currently do is select into a Java stored procedure which has many database access calls. What we would like to do is select against a PL/SQL stored procedure to aggregate the data and then pass that data via a ref cursor (or whatever structure is acceptable) to a Java stored procedure. This would save us a significant amount of work since the current Java stored procedures would simple need to be changed to not make database calls since the data would be handed to them.
Is there a way to send a ref cursor from PL/SQL as an input parameter to a Java stored procedure? My call would potentially look like this:
SELECT java_stored_proc(pl/sql_stored_proc(col_id))
FROM table_of_5000_rows;
Sorry for the lengthy post. -
Jdbc and java stored procedures
Hi all,
I am new to Oracle Java Stored Procedures but I am interested in knowing to which extent is object passing supported.
Can I send any kind of object to a java stored procedure? And back from the procedure? Anybody knows any good resources online about Java Stored Procedures and JDBC?
I also saw that to pass the string back you need to specify java.lang.string, how would I do in order to pass back a user defined object, do I have to register the class in Oracle before (and if yes, how?)or is the classpath enough?
Many thanks,
A.Hi again,
perhaps I didn't understand exactly what you meant with "publish", AFAIK you have to expose the java class (i.e. RowCounter) by using
CREATE OR REPLACE FUNCTION row_count (tab_name VARCHAR2) RETURN NUMBER
AS LANGUAGE JAVA
NAME 'RowCounter.rowCount(java.lang.String) return int';
(BTW this works fine)
or else you cannot access the java class you loaded on the server, and that's where my questions arose. What if I am passing an object, let's say myObject, shouldn't I use the STRUCT mapping then or something like that?
Or, could you clarify what do you mean by publishing to SQL, I just need to access the class from jdbc, not from PL/SQL or others, but as I understand to call the class from JDBC I need to call the function or procedure that calls the class and then I could call it from PL/SQL as well...
Thanks,
A. -
Jena Adapter API access from Java Stored Procedures?
Is it possible to use Jena API from code in java stored procedures in Oracle DBMS 11gR2? Possible but not recommended?
The reason is that my company uses .Net as the application server plattform (not Java). Calling Java Stored Procedures from .Net is one way to use Jena library.
Thank you!
TrondHi Trond,
Unfortunately the sdordfclient.jar was compiled and built with JDK 6 and the JVM supported in the Oracle database 11gR2 is JDK5.
If you have a strong requirement, please file a SR against Oracle support. We will then look into a possible recompilation and
rebuild.
Thanks,
Zhe Wu -
Memory leak in java stored procedure
I use one simple example to test java stored procedure but i have met one serious problem. If it's not my fault, there exists serious bug of Oracle JVM. And the problem make it more like a toy.
(1) java program Test.java
public class Test {
public static void tst() {
(2) javac Test.java
(3) loadjava -user scott/tiger -oci8 -resolve -verbose Test.class
(4) create or replace procedure tst
AS LANGUAGE JAVA
NAME 'Test.tst()';
(5) test.sql
Begin
for loop_v in 1..100000000 loop
tst();
end loop;
end;
(7) execute the test.sql
sqlplus scott/tiger
@test (6) oracle version information:
oracle 8.1.7, Linux 2.4.2
(7) problem:
When the test.sql is executed , I use top tool to monitor the oracle process. I found the column SIZE value is gradually climbed. When reaching some point test.sql lose connection with oracle server. It always use out all the memory of Linux system.
If the test is correct, I think oracle java stored procedure is just like one toy.
zhu zhong huaI'll try to define it for the OP
Define: memory leakhttp://en.wikipedia.org/wiki/Memory_leak
Define: bestDoesn't really apply but wondered what wikipedia would return: http://en.wikipedia.org/wiki/Best
Define: testhttp://en.wikipedia.org/wiki/Software_testing -
Java Stored Procedure in one database connecting to muntiple databases.
Hello,
I created a Java Stored Procedure in one database(Oracle10g) and successfully open a connection to another database(Oracle10g) using Thin JDBC Driver. I want to actually transfer CLOB data from one DB to another DB. I am concern that by opening a connection another database in Java Stored Procedure, might interfere with oracle and destabilize the instance at some point. Oracle JDBC FAQ (Link: http://www.oracle.com/technology/tech/java/sqlj_jdbc/htdocs/jdbc_faq.htm#34_13) stated that Yes it could be done but then mentioned the workaround.(if it could be done why do we need a workaround!!!)
I would like to confirm whether connecting to multiple DB using JDBC Thin Driver in a Java Stored Procedure is supported by Oracle10g or not and whether it has any known issue with it.
Thanks in Advance!
Edited by: user649261 on Sep 16, 2008 8:05 PMhrishy wrote:
Thanks i have modified the title so its easy to comprehendWrite the two parts mentioned above and post if you get problems with your code.
First write code that calls the stored procedure and test that to make sure that it works.
Then write a simple webservice and test it out to make sure it works. The integration should be trivial after that. -
How to write call specs for a java stored procedure that takes a nested obj
Example Class :
public class B {
int number;
String str;
public class A {
private B[] _childern;
public B[] getChildern(){
return _children
public static void saveAll(A a) throws SQLException {
B[] children = a.getChildern();
for(int i=0; i<children.length; i++){
saveChild(children);
public static void saveChild(B ch)throws SQLException {
// do something
What would be the call specification for the method A.saveAll(A)? Your help will be apprecited.
Thank you
AjmalIn other words, How to pass a Java Object from a Java stored procedure to a Java client ???
Hello,
I don't know to deal with a Vector object that has been generated from a stored procedure.
Should I create first in the JDBC client and pass it as argument to the procedure ?
Thanks in advance. Here is an extract ...
On the client side :
<<
Vector buffer = new Vector();
CallableStatement call =
con.prepareCall ("{call my_procedure_run (?, ?)}");
call.registerOutParameter(2, java.sql.Types.JAVA_OBJECT );
call.setString (1, "bla bla bla");
call.setObject (2, buffer);
call.execute ();
buffer = (Vector)call.getObject (2);
>On the Java stored procedure
<<
public class my_procedure
public static void Run(String input_value, Vector buffer)
// ??? Vector buffer = new Vector();
try
while ( true )
buffer.addElement(...) ;
catch(Exception ex) { } -
ORA-04030: out of process memory when using Java Stored Procedures
Hello,
I have a problem using Java Stored Procedures in Oracle 10g.
My Java application performs http posts to a webservice and the response is parsed in order to populate some DB tables.
There is a scheduled job which calls the Java Stored Procedure every x minutes.
No matter of the 'x minutes' values - after about 160 - 200 calls I get this error:
ORA-04030: out of process memory when trying to allocate 1048620 bytes (joxp heap,f:OldSpace)
ORA-04030: out of process memory when trying to allocate 2097196 bytes (joxp heap,f:OldSpace)
The job stops just while is posting the http request. The weird thing is that almost each time the first http post request I get this error:
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
at java.net.Socket.connect(Socket.java:426)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(DashoA6275)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createSocket(ReflectionSocketFactory.java:140)
at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.createSocket(SSLProtocolSocketFactory.java:130)
at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
and the second try works fine.
So, The out of process memory occured each time just before getting such an error, and I suspect to be a connection between these errors.
Tech details:
1. OS: WinXP
2. Oracle 10.1.0.2.0
3. To perform http post I use HttpClient 3.1 from Apache.
4. I checked the http connection to be closed each time, and this is done.
5. I checked the oracle statement and connection to be closed each time and this is done
6. The JVM error (logged in .trc files of Oracle) is:
java.lang.OutOfMemoryError
at java.lang.Thread.start(Native Method)
at sun.security.provider.SeedGenerator$ThreadedSeedGenerator.run(SeedGenerator.java:297)
DB Settings details:
Starting up ORACLE RDBMS Version: 10.1.0.2.0.
System parameters with non-default values:
processes = 200
sessions = 225
shared_pool_size = 159383552
large_pool_size = 8388608
java_pool_size = 104857600
nls_language = AMERICAN
control_files = C:\ORACLE\PRODUCT\10.1.0\ORADATA\XXXXXX\CONTROL01.CTL, C:\ORACLE\PRODUCT\10.1.0\ORADATA\XXXXXX\CONTROL02.CTL, C:\ORACLE\PRODUCT\10.1.0\ORADATA\XXXXXX\CONTROL03.CTL
db_block_size = 8192
db_cache_size = 29360128
compatible = 10.1.0
fal_client = XXXXXX
fal_server = XXXXXXs
log_buffer = 524288
log_checkpoint_interval = 100000
db_files = 70
db_file_multiblock_read_count= 32
db_recovery_file_dest = C:\oracle\product\10.1.0\flash_recovery_area
db_recovery_file_dest_size= 2147483648
standby_file_management = AUTO
undo_management = AUTO
undo_tablespace = undotbs_01
undo_retention = 14400
remote_login_passwordfile= EXCLUSIVE
db_domain =
dispatchers = (PROTOCOL=TCP) (SERVICE=XXXXXXXDB)
remote_dependencies_mode = SIGNATURE
job_queue_processes = 4
parallel_max_servers = 5
background_dump_dest = C:\ORACLE\PRODUCT\10.1.0\ADMIN\XXXXXX\BDUMP
user_dump_dest = C:\ORACLE\PRODUCT\10.1.0\ADMIN\XXXXXX\UDUMP
max_dump_file_size = 10240
core_dump_dest = C:\ORACLE\PRODUCT\10.1.0\ADMIN\XXXXXX\CDUMP
sort_area_size = 1048576
sort_area_retained_size = 1048576
db_name = XXXXXX
open_cursors = 500
optimizer_mode = FIRST_ROWS
pga_aggregate_target = 25165824
Any help would be appreciated. Thanks.
Can be a problem with JVM threading under Oracle ?The server prcess failed to allocate more memory for large objects ( in Oldspace).
If you Google ORA-04030, you will see several recommendations to work around this.
The Java VM in the database already has HttpClient, i don't know why you are loading the Apache HttpClient but this might not be the surce of the problem.
Kuassi http://db360.blogspot.com -
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, -
Invoking "java myClass" using Runtime.Exec from a Java Stored Procedure
Hi All,
This is regarding the use of Runtime.getRunTime().exec, from a java programme (a Java Stored Procedure), to invoke another Java Class in command prompt.
I have read many threads here where people have been successuful in invoking OS calls, like any .exe file or batch file etc, from withing Java using the Runtime object.
Even i have tried a sample java programme from where i can invoke notepad.exe.
But i want to invoke another command prompt and run a java class, basically in this format:
{"cmd.exe","java myClass"}.
When i run my java programme (in command prompt), it doesnt invoke another command prompt...it just stays hanging.
When i run the java programme from my IDE, VisualCafe, it does open up a command prompt, but doesnt get the second command "java myCLass".
Infact on the title of the command prompt (the blue frame), shows the path of the java.exe of the Visual Cafe.
and anyway, it doesnt run my java class, that i have specified inside the programme.
Even if i try to run a JAR file, it still doesnt do anything.
(the JAR file other wise runs fine when i manually invoke it from the command prompt).
Well, my question is, actually i want to do this from a Java Stored Procedure inside oracle 8.1.7.
My feeling is, since the Java Stored Procedure wont be running from the command prompt (i will be actually invoking it through a Oracle trigger), it may be able to invoke the command prompt and run the java class i want. and that java class has to run with the SUn's Java, not Oracle JAva.
Does any one have any idea about it?
Has anyone ever invoked a java class or JAR file in command prompt from another Java Programme?
YOur help will be highly appreciated.
(P:S- Right now, my database is being upgraded, so i havent actually been able to create a Java Stored procedure and test it. But i have tested from a normal java programme running in command prompt and also from Visual Cafe).
Thanks in advance.
-- Subhasree.Hello Hari,
Thanks for your quick reply.
Can you please elaborate a little more on exactly how you did? may be just copy an dpaste taht part of teh code here?
Thanks a lot in advance.
--Subhasree -
How to call java stored procedure using RMI?
Is it possible to make a call to java stored procedure using RMI. ?
How can I run the RMI registry on the Oracle Server ?<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Thomas Grounds ([email protected]):
Is it possible to make a call to java stored procedure using RMI. ?
In principle it is possible. See the Java-Doc.s of Oracle 8.1.6.
I have successful granted the java.net.SocketPermissions in my USER_JAVA_POLICY view (see Doc.) Now I was able to use the RMI-Sockets, but following
failure try to connect to RMI-Object via RMIregistry an Oracle Error occurs
ORA-03113: end-of-file on communication channel
and after that my Oracle Connection is closed.
How can I run the RMI registry on the Oracle Server ?<HR></BLOCKQUOTE>
I think you do not need the RMI registry on Oracle Server. It should be possible to start the RMI registry wherever you want in your network and access it via the right registry string.
Ciao
Margit
null -
Error while deploying a Java Stored Procedure using JDeveloper
Hi,
I was going thru the Oracle By Example article: "Developing SQL and PL/SQL with JDeveloper". (http://www.oracle.com/technology/obe/obe9051jdev/ide1012/plsqlobe/obeplsql.htm)
One of the items in this article is - "Creating and Deploying a Java Stored Procedure"
I was able to create a java class, compile it. Created a deployment profile. created a pl/sql wrapper. While trying to deploy the java stored procedure, I am getting the following error:
Invoking loadjava on connection 'hr_conn' with arguments:
-order -resolve -thin
errors : class package1/mypackage/JavaStoredProc
ORA-29521: referenced name java/lang/StringBuilder could not be found
The following operations failed
class package1/mypackage/JavaStoredProc: resolution
oracle.aurora.server.tools.loadjava.ToolsException: Failures occurred during processing
at oracle.aurora.server.tools.loadjava.LoadJava.process(LoadJava.java:863)
at oracle.jdeveloper.deploy.tools.OracleLoadjava.deploy(OracleLoadjava.java:116)
at oracle.jdeveloper.deploy.tools.OracleLoadjava.deploy(OracleLoadjava.java:46)
at oracle.jdevimpl.deploy.OracleDeployer.deploy(OracleDeployer.java:97)
at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:474)
at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:361)
at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:285)
at oracle.jdevimpl.deploy.StoredProcProfileDt$Action$1.run(StoredProcProfileDt.java:383)
#### Deployment incomplete. #### Oct 27, 2005 1:38:56 PM
Appreciate your help on this..I am using Jdeveloper 10.1.3 Early Access Version. JDK comes with it. I also have another JDK on my machine (JDK1.4.2_09)
Maybe you are looking for
-
Ipod touch 2nd Generation can't download Apps?
My nephew was given a ipod touch 4th generation, and so he gave me his ipod touch 2nd generation; after resetting the ipod and setting up an account on itunes, as well as authorising my computer, this ipod can not download apps like angry birds, howe
-
Right-click on Magic Mouse and Volume Controls on Wireless keyboard suddenly stopped working
I am running Mavericks 10.9.2 on an Late 2012 iMac. One morning the right click on my Magic Mouse and the volume controls on the wireless keyboard stopped working. These mouse and keyboard themselves seem fine; they work okay ehn used on a MacBook. E
-
Memory leak when exceptions are thrown?
Hello, I'm doing a simple database connect with the JDBC Oracle 8.1.6 oci8 drivers on Solaris. It seems whenever I try to repeatedly connect to a database, and an exception is thrown, such as database not found, or wrong password, the program size gr
-
Reminders still appearing after deletion
I have an issue with the reminders app on my iphone in which a certain location based reminder keeps appearing when i get to this location even though i deleted it months ago. Any ideas would be great. I have a feelingi might need to reset the phone
-
Dears, I need to configure Buisness Process Monitoring on my solman 7.0 server. Please share some document for it. Shivam