Calling Java Stored Procedure failed SQLXML
I tried to upload a simple class to Oracle in which I want to use java.sql.SQLXML class using:
loadjava -u user/passwd@host:1521:xyz -v -resolve C:\develop\workspaces\Test\src\lbb\apc\test\JavaStoredProcedureTest.java
loadjava answers with:
creating : source lbb/apc/test/JavaStoredProcedureTest
loading : source lbb/apc/test/JavaStoredProcedureTest
resolving: source lbb/apc/test/JavaStoredProcedureTest
errors : source lbb/apc/test/JavaStoredProcedureTest
ORA-29535: Quelle erfordert Neukompilierung
lbb/apc/test/JavaStoredProcedureTest:6: cannot find symbol
symbol : class SQLXML
location: package java.sql
import java.sql.SQLXML;Then I found that the Oracle JDBC driver does not support the SQLXML type, thus changing my program to use XMLType:
XMLType sqlXml = (XMLType)rs.getSQLXML(1);but it doesn't help as well as it doesn't help to use
Clob clob = rs.getClob(1);Finally I tried (and failed) to use
Object obj = rs.getObject(1);
results in:
java.sql.SQLException: ORA-29532:Java call terminated by uncaught Java exception:What can I do to solve this problem?
I wrote it for an example. sorry i should be clear.
Here is the code i am running check WORKING & NOT WORKING lines. What am i missing
PL SQL package
CREATE OR REPLACE PACKAGE BODY APPS.hypr_Reference_designator as
function hypr_xsl ( dbInstance IN VARCHAR2, Parent_ItemNum IN VARCHAR2)
return varchar2
as language java name 'hypr_ref_designator_xsl.hypr_xsl(java.lang.String,java.lang.String) return java.lang.String';
procedure hypr_xsl(dbInstance IN VARCHAR2, Parent_ItemNum IN VARCHAR2)
is
itemNum VARCHAR2(30);
db Varchar2(30);
print_string varchar2(200);
begin
db:=dbInstance;
itemNum:=Parent_ItemNum;
print_string := hypr_xsl(db,itemNum); --NOT WORKING
print_string := hypr_xsl('DEV','123'); --WORKING
commit;
DBMS_OUTPUT.PUT_LINE(print_string || db || itemNum);
end hypr_xsl;
END hypr_Reference_designator;Java Stored Procedure
CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED APPS.HYPR_REF_DESIGNATOR_XSL as import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import jxl.*;
import oracle.jdbc.driver.*;
import java.sql.*;
import java.util.Properties;
public class hypr_ref_designator_xsl {
public hypr_ref_designator_xsl() {
public static void main(String[] args) {
public static String hypr_xsl(String dbinstance, String parent_itemNum) {
System.out.print(dbinstance);
System.out.print(parent_itemNum);
return "";
//does some process here
}
Similar Messages
-
Error calling Java Stored Procedure
hi I am calling java stored procedure from jdbc. i am getting wierd exceptions:
CallableStatement cstmt = conn.prepareCall("begin SEND_MAIL(?,?,?);end;");
cstmt.setString(1,"[email protected]");
cstmt.setString(2,"Mail from Stored Proc");
cstmt.setString(3,"This is test mail from Oracle8i");
cstmt.execute();
i am getting following Exception:
java.sql.SQLException: ORA-29532: Java call terminated by uncaught Java exception: java.security.AccessControlException: the Permission (java.util.PropertyPermission * read,write) has not been granted by dbms_java.grant_permission to SchemaProtectionDomain(ISTORE_CUST|PolicyTableProxy(ISTORE_CUST))
ORA-06512: at "ISTORE_CUST.SEND_MAIL", line 0
ORA-06512: at line 1
nullI think u dont've previleges to run
the procedure.
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by arunr12:
hi I am calling java stored procedure from jdbc. i am getting wierd exceptions:
CallableStatement cstmt = conn.prepareCall("begin SEND_MAIL(?,?,?);end;");
cstmt.setString(1,"[email protected]");
cstmt.setString(2,"Mail from Stored Proc");
cstmt.setString(3,"This is test mail from Oracle8i");
cstmt.execute();
i am getting following Exception:
java.sql.SQLException: ORA-29532: Java call terminated by uncaught Java exception: java.security.AccessControlException: the Permission (java.util.PropertyPermission * read,write) has not been granted by dbms_java.grant_permission to SchemaProtectionDomain(ISTORE_CUST|PolicyTableProxy(ISTORE_CUST))
ORA-06512: at "ISTORE_CUST.SEND_MAIL", line 0
ORA-06512: at line 1
<HR></BLOCKQUOTE>
null -
21700 while calling java stored procedure in 9i
I create a java stored procedure that takes a varray of a rowtype. When I call that procedure, I get an ora-21700. If I remove the varray from the parameter list, I can call the procedure okay. My goal is to create a generic java procedure that can take a rowtype from any table and create XML. Once I get the oracle.sql.ARRAY into my code, I am okay. I just can't seem to pass it in. I have pasted my code below:
Java:
import oracle.sql.*;
public class test {
public static String sayHello() {
return("Hello, World!");
public static void genXML(oracle.sql.ARRAY a, oracle.sql.CLOB c) throws Exce
ption {
c.putString(1,"<test>This is a test!</test>");
PL/SQL:
create or replace package mike is
type dummy_record is varray (1) of dummy%rowtype;
PROCEDURE GENERATE_XML(i dummy_record, c CLOB);
FUNCTION SAYHELLO RETURN varchar2;
end mike;
show errors
create or replace package body mike is
PROCEDURE GENERATE_XML(i dummy_record,c CLOB)
AS LANGUAGE JAVA
NAME 'test.genXML(oracle.sql.ARRAY,oracle.sql.CLOB)';
FUNCTION SAYHELLO RETURN varchar2
AS LANGUAGE JAVA
NAME 'test.sayHello() return java.lang.String';
end mike;
show errors
DDL:
SQL> describe dummy
Name Null? Type
USERNAME VARCHAR2(20)
ID NUMBER
Test Script:
declare
m Mike.dummy_record := Mike.DUMMY_RECORD();
c CLOB;
begin
m.extend;
select xml into c from t_clob;
for rec in (select * from dummy)
LOOP
m(1) :=rec;
mike.generate_xml(m,c);
end loop;
end;
And finally, the output:
declare
ERROR at line 1:
ORA-21700: object does not exist or is marked for delete
ORA-06512: at "MMANGINO.MIKE", line 0
ORA-06512: at line 10
Sorry this post is so long, but I wanted it to be complete!
MikeThe first solution is to not do that in java in the first place.
DDL should be in script files which are applied to oracle outside of java.
Other than I believe there are some existing stored procedures in Oracle that take DDL strings and process them. Your user has to have permission of course. You can track them down via the documentation. -
No method found error when calling java stored procedured
hi:
i am rather confused about this. i have written several
java stored procedures and all of them work fine. but when i tried another one , the error message 'no method found 'occurs
when i call the procedure from sqlplus.
it' s a simple procedure . but it's very strange and happens
from time to time
my compile shell as following
javac -classpath $ORACLE_HOME/jdbc/lib/classes12.zip GenFiles.java
$ORACLE_HOME/bin/loadjava -u zw/zw@aixtest GenFiles.class
and
my definition as following
create or replace procedure files(chargeCyckeID varchar2, cycleStart varchar2,cycleEnd varchar2,
loginName varchar2, filePath varchar2, start1 number, end1 number, step number)
AS LANGUAGE JAVA
NAME 'GenFiles.genFile(String , String , String , String , String , int , int , int )';
and my java code is here :
import java.sql.*;
import java.io.*;
import oracle.jdbc.driver.*;
public class GenFiles{
public static void main(String[] args){
04UU<F7QV\FZ#,V\FZ?*J<#,V\FZ=aJx#,5GB<C{#, ND<~B7>6#,Pr:E?*J<#,Pr:E=aJx#,2=3$#(Iz3IND<~5D<GB<J}#)
public static void genFile(String chargeCycleID, String cycleStart, String cycleEnd, String loginName, String filePath, int start, int end, int step){
try{
String sqllist = "select customer_id,contract_code, usercode,ani,ord,"
+ " agent_code,linkman, customer_name , postcode,paymethod_category_id ,"
+ " ltrim(to_char(cost,'999999990.99')) cost,call_duration,from listani_file where ord> ? and ord<? order by contract_code";
String sqlcalls1 = "select a.ani || ',' || a.PASS || ',' || to_char(a.START_TIME,'yyyy-mm-dd hh24:mi:ss') stime || ',' || trunc(a.CALL_DURATION/60)||':'||ltrim(to_char(mod(a.CALL_DURATION,60),'09')) CALL_DURATION || ',' || ltrim(to_char((CALL_AMOUNT/ceil(CALL_DURATION/60)),'999999990.99')) RATE || ',' || ltrim(to_char(a.CALL_AMOUNT,'999999990.99')) CALL_AMOUNT"
+" from call_fact_mind a "
+" where a.usercode=?"
+ " and a.ani=? "
+ " and a.period_key<='" + end + "'"
+ " and a.period_key>='" + start + "'"
+ " and a.charge_flag='Y' "
+ " and a.CALL_DURATION>6"
+ " and a.CALL_AMOUNT>0"
+" order by a.period_key";
String sqlcalls2 = "select a.ani || ',' || a.PASS || ',' || to_char(a.START_TIME,'yyyy-mm-dd hh24:mi:ss') stime || ',' || trunc(a.CALL_DURATION/60)||':'||ltrim(to_char(mod(a.CALL_DURATION,60),'09')) CALL_DURATION || ',' || ltrim(to_char((CALL_AMOUNT/ceil(CALL_DURATION/60)),'999999990.99')) RATE || ',' || ltrim(to_char(a.CALL_AMOUNT,'999999990.99')) CALL_AMOUNT "
+ " from call_fact_mind a "
+ " where a.usercode=?"
+ " and a.period_key<='" + end + "'"
+ " and a.period_key>='" + start + "'"
+ " and a.charge_flag='Y' "
+ " and a.CALL_DURATION>6"
+ " and a.CALL_AMOUNT>0"
+" order by a.period_key";
Connection con = new OracleDriver().defaultConnection();
try{
int i = start;
//8y>]2=3$Q-;7
while( true){
if( i>=end ) break;
genFile(con, i , i+step, chargeCycleID, loginName, filePath, sqllist, sqlcalls1, sqlcalls2);
i += step;
}catch(Exception ex){
}finally{
if( con != null) con.close();
}catch(Exception exx){}
8y>]2=3$Iz3IND<~
private static void genFile(Connection con, int start, int end, String chargeCycleID, String loginName, String filePath, String sqllist, String sqlcalls1, String sqlcalls2) throws Exception{
PreparedStatement ps1 = null;
PreparedStatement ps2 = null;
PreparedStatement ps3 = null;
ResultSet rs1 = null;
ResultSet rs2 = null;
String fileName = filePath + System.getProperty("file.separator") + start + "_" + end + ".txt";
BufferedWriter writer = null;
try{
writer = new BufferedWriter(new FileWriter(fileName));
ps1 = con.prepareStatement(sqllist);
ps2 = con.prepareStatement(sqlcalls1);
ps3 = con.prepareStatement(sqlcalls2);
ps1.setInt(1, start);
ps1.setInt(2, end);
rs1 = ps1.executeQuery();
//Iz3Ibuffer,V;SPR;6(<GB<J12EP4HkND<~
StringBuffer strBuffer = new StringBuffer();
int i =0;
//Q-;7:OM,=a9{</
String preContractCode = "";
String currentContractCode = "";
while( rs1.next()){
currentContractCode = rs1.getString("contract_code");
if( rs1.getString("ani") == null){
ps2.setString( 1, rs1.getString("usercode"));
rs2 = ps2.executeQuery();
}else{
ps1.setString(1, rs1.getString("usercode"));
ps1.setString(2, rs1.getString("ani"));
rs2 = ps1.executeQuery();
//Hg9{3vOVPB5D:OM,:E#,<SHk:OM,OnM7,contract_costJG:OM,On7QSC
if( ! preContractCode.equals(currentContractCode)){
//TZG0Cf<SHk?UPP
strBuffer.append("\r\n");
String contractHead = "\"1\"" + ",\"" + rs1.getString("linkman") + "\",\"" + rs1.getString("customer_name")
+ "\",\"" + rs1.getString("contract_code") + "\",\"" + rs1.getString("agent_code")
+ "\",\"" + chargeCycleID + "\",\"" + rs1.getString("contract_cost") + "\"";
strBuffer.append(contractHead);
while( rs2.next()){
if( i<1000){
i++;
strBuffer.append("\"2\"" + rs2.getString(1));
}else{
String str = strBuffer.toString();
writer.write(str, 0, str.length());
strBuffer = new StringBuffer();
strBuffer.append(rs2.getString(1));
i = 1;
//<SHk7QSC:O<F
if( rs1.getString("ani") == null){
String trail = "\"2\"" + ",\"" + "ani: " + "\",\"" + rs1.getString("ani") + "\",\"" + "Total Amount: " + "\",\"" + rs1.getString("cost") + "\"\r\n";
strBuffer.append(trail);
}else{
String trail = "\"2\"" + ",\"" + "usercode: " + "\",\"" + rs1.getString("usercode") + "\",\"" + "Total Amount: " + "\",\"" + rs1.getString("cost") + "\"\r\n";
strBuffer.append(trail);
preContractCode = currentContractCode;
writer.close();
rs2.close();
}catch(Exception ex){
}finally{
if( rs1 != null) rs1.close();
if( rs2 != null) rs2.close();
if( ps1 != null) ps1.close();
if( ps2 != null) ps2.close();
i need your help!
regards
daniel wangHi again, Daniel,
I'm only guessing here, but unless you've made lots of mistakes when
you copied your code to your post to the forum, your method signatures
don't match. The definition of "genFile" in your java class is quite
different to what you wrote in your PL/SQL wrapper.
Also, you have defined "genFile" to be a private method -- I think it
needs to be public.
Also, I think the "main" method doesn't need to be in the "GenFiles"
class -- perhaps you should remove it.
Also, I think in your PL/SQL wrapper you need to use fully qualified
names, so use "java.lang.String" and not just "String".
Lastly, I think you should use the "-force" and "-resolve" flags
with the "loadjava" command.
Good Luck,
Avi. -
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 -
Java stored procedure failes to create.
Hi All,
I have a java program with following import statement.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
Basically I am trying to make a HTTP post inside the jave code.
My code complies properly but when I try to create the stored precudere I get the error
"Procedure created with compilation errors."
Any Idea what is causing the problem.
Thanks in advance,
BikramHi Schoeib,
Thanks for your reply.
I found the problem, the env variable Path was not properly defined.
I am getting another issue now.Is there any restriction in accessing non static reference from the main class (which is used for creating the stored procedure).
Static Wrapper --> non static class (All in one Jar).
The compilation is okay ,even java stored proc got created,but when I execute the proc I get "no method mymethod in class myclass"
Any Idea.
Thanks & regards,
Bikram -
Loading jar files and calling java stored procedure
I am trying to load jai_core.jar, jai_codec.jar, mlibwrapper.jar and another class I created into my project schema. I am having problems with resolving all of the class using the "loadjava -resolve" command as well as using the "alter java class" command. The single class I authored is not in a valid state as well as the PL/SQL wrapper for the function I am calling.
My questions are:
1) Does the single class need to be in a valid state before the PL/SQL wrapper will compile and be in a valid state itself?
2) Are there any special tricks to this becuase the code I am using below doesn't seem to be working correctly?
3. Should I worry about "resolving/validating" all of the class from the jar file? I have read conflicting views on this topic.
SQL> CREATE OR REPLACE FUNCTION get_image (p_fileName in varchar2, p_offset in number )
2 RETURN blob AS LANGUAGE Java
3 NAME 'gov.irs.rtr.image.ImageUtilityFunction.getImage (java.lang.String, int) RETURN oracle.sql.BLOB';
4 /
Warning: Function created with compilation errors.
SQL> show err
Errors for FUNCTION GET_IMAGE:
LINE/COL ERROR
0/0 PL/SQL: Compilation unit analysis terminated
3/1 PLS-00311: the declaration of
"gov.irs.rtr.image.ImageUtilityFunction.getImage
(java.lang.String, int) RETURN oracle.sql.BLOB" is incomplete or
malformed
Any help would be greatly appreciated.
Regards,
JoeyWe are using Oracle 9.2.0.8 and I have written the single class in 1.3.1.
The first loadjava commands I tried were:
loadjava -user username/password -resolve -resolver '((* RTRPROD)(* PUBLIC))' jai_core.jar jai_codec.jar mlibwrapper_jai.jar
loadjava loadjava -user username/password -resolve -resolver '((* RTRPROD)(* PUBLIC) (* -))' ImageUtility.class
Then I tried:
loadjava -user username/password -resolve -resolver '((* RTRPROD)(* PUBLIC) (* -))' jai_core.jar jai_codec.jar mlibwrapper_jai.jar
errors : class javax/media/jai/operator/EncodeDescriptor
ORA-29534: referenced object RTRPROD.com/sun/media/jai/codec/ImageCodec could not be resolved
errors : class javax/media/jai/operator/FileStoreDescriptor
ORA-29534: referenced object RTRPROD.com/sun/media/jai/codec/ImageCodec could not be resolved
errors : class com/sun/media/jai/opimage/BMPRIF
ORA-29534: referenced object RTRPROD.com/sun/media/jai/opimage/CodecRIFUtil could not be resolved
errors : class com/sun/media/jai/opimage/CodecRIFUtil
ORA-29534: referenced object RTRPROD.com/sun/media/jai/codec/ImageCodec could not be resolved
errors : class com/sun/media/jai/opimage/EncodeRIF
ORA-29534: referenced object RTRPROD.com/sun/media/jai/codec/ImageCodec could not be resolved
errors : class com/sun/media/jai/opimage/FPXRIF
ORA-29534: referenced object RTRPROD.com/sun/media/jai/opimage/CodecRIFUtil could not be resolved
errors : class com/sun/media/jai/opimage/GIFRIF
ORA-29534: referenced object RTRPROD.com/sun/media/jai/opimage/CodecRIFUtil could not be resolved
errors : class com/sun/media/jai/opimage/IIPCRIF
ORA-29534: referenced object RTRPROD.com/sun/media/jai/codec/ImageCodec could not be resolved
This error messages goes on and on for 44 files.
I have found out that JAI is part of the Oracle 9 Release 2 but is part of the InterMedia package that is not installed. I would imagine that the JAI libraries mentioned above would be included in InterMedai. However, there are several dependencies on packages distributed in the Sun JDK but not the Oracle Runtime.
Regards,
Joey -
Deploying Java Stored Procedure Failed
Hello,
I have a java class and when I try to deploy using jdeveloper to oracle database 9i, I am getting the following errors.
What could be the reasons
Error while creating class pass/com/Card
ORA-01031: insufficient privilegesjava.sql.SQLException: ORA-01031: insufficient privileges
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:124)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:304)knutst,
I don't use JDeveloper, but I would suggest trying to do these operations not via JDeveloper in order to see whether the problem is with JDeveloper's wizards, or not.
Compile the java classes using "javac" -- from the command line, then load them into the database using "loadjava" -- also from the command line.
Good Luck,
Avi. -
EJB calling Java Stored Procedure / Problem sending mail
I have a test code very similar to the sample - actually
copied it from there. When i want to send a mail from my 9iR2 database, i get the following exception:
javax.mail.NoSuchProviderException: No provider for Address type: rfc822
at javax.mail.Session.getTransport(Session.java:516)
at javax.mail.Transport.send0(Transport.java:155)
at javax.mail.Transport.send(Transport.java:81)
at cwt.exception.CWTPublicException.sendMail(CWTPublicException.java:97)
at cwt.sp.Test.testExceptions(Test.java:42)
When I use the Transport class to explicitly set 'smtp' as transport with
message.saveChanges();
Transport transport = session.getTransport("smtp");
transport.connect(bundle.getString("smtp-host"), bundle.getString("smtp-user"),
bundle.getString("smtp-pwd"));
transport.sendMessage(message, message.getAllRecipients());
transport.close();
then i also get an exception:
javax.mail.NoSuchProviderException: No provider for smtp
at javax.mail.Session.getProvider(Session.java:289)
at javax.mail.Session.getTransport(Session.java:483)
at javax.mail.Session.getTransport(Session.java:464)
at cwt.exception.CWTPublicException.sendMail(CWTPublicException.java:101)
at cwt.sp.Test.t[i]Long postings are being truncated to ~1 kB at this time.Hi,
This exception usualy occurs when the handlers haven't been imported in your application.
Please check whether you have imported following in your source code.
import javax.mail.*;
import javax.mail.internet.*;
Also make sure that you have loaded " latest " mail.jar and activation.jar into the database.
Cheers
--Venky -
NameFromLastDDL Error during java stored procedure upload...
Hi guys,
I am trying to upload a class to send email within a java stored procedure.
JDeveloper fails to upload the class, and the error message doesn't help me:
I guess the automatically generated SQL statment features a "NameFromLastDDL" argument, but i have no control over that....anybody had this issue before ?
Following, the "ugly" exception:
Error while creating class client/Utils
ORA-06550: line 1, column 91:
PLS-00201: identifier 'NameFromLastDDL' must be declared
ORA-06550: line 1, column 85:
PL/SQL: Statement ignored
java.sql.SQLException: ORA-06550: line 1, column 91:
PLS-00201: identifier 'NameFromLastDDL' must be declared
ORA-06550: line 1, column 85:
PL/SQL: Statement ignored
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:316)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:282)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:639)
at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:184)
at oracle.jdbc.driver.T4CCallableStatement.execute_for_rows(T4CCallableStatement.java:873)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1086)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2984)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3076)
at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4273)
at oracle.aurora.server.tools.loadjava.ClientClassObject.create(ClientClassObject.java:68)
at oracle.aurora.server.tools.loadjava.SchemaObject.process1(SchemaObject.java:223)
at oracle.aurora.server.tools.loadjava.LoadJava.add(LoadJava.java:530)
at oracle.aurora.server.tools.loadjava.LoadJava.addClass(LoadJava.java:584)
at oracle.aurora.server.tools.loadjava.LoadJava.add(LoadJava.java:434)
at oracle.aurora.server.tools.loadjava.LoadJava.add(LoadJava.java:378)
at oracle.aurora.server.tools.loadjava.LoadJava.addJar(LoadJava.java:717)
at oracle.aurora.server.tools.loadjava.LoadJava.add(LoadJava.java:430)
at oracle.aurora.server.tools.loadjava.LoadJava.add(LoadJava.java:378)
at oracle.aurora.server.tools.loadjava.LoadJava.add(LoadJava.java:347)
at oracle.aurora.server.tools.loadjava.LoadJava.add(LoadJava.java:643)
at oracle.aurora.server.tools.loadjava.LoadJava.processDeferredFiles(LoadJava.java:615)
at oracle.aurora.server.tools.loadjava.LoadJava.process(LoadJava.java:806)
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:473)
at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:360)
at oracle.jdevimpl.deploy.StoredProcHandler.doDeployToMostRecent(StoredProcHandler.java:256)
at oracle.jdevimpl.deploy.StoredProcProfileDt$2.run(StoredProcProfileDt.java:193)
The following operations failed
class client/Utils: creation (createFailed)
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:473)
at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:360)
at oracle.jdevimpl.deploy.StoredProcHandler.doDeployToMostRecent(StoredProcHandler.java:256)
at oracle.jdevimpl.deploy.StoredProcProfileDt$2.run(StoredProcProfileDt.java:193)I think u dont've previleges to run
the procedure.
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by arunr12:
hi I am calling java stored procedure from jdbc. i am getting wierd exceptions:
CallableStatement cstmt = conn.prepareCall("begin SEND_MAIL(?,?,?);end;");
cstmt.setString(1,"[email protected]");
cstmt.setString(2,"Mail from Stored Proc");
cstmt.setString(3,"This is test mail from Oracle8i");
cstmt.execute();
i am getting following Exception:
java.sql.SQLException: ORA-29532: Java call terminated by uncaught Java exception: java.security.AccessControlException: the Permission (java.util.PropertyPermission * read,write) has not been granted by dbms_java.grant_permission to SchemaProtectionDomain(ISTORE_CUST|PolicyTableProxy(ISTORE_CUST))
ORA-06512: at "ISTORE_CUST.SEND_MAIL", line 0
ORA-06512: at line 1
<HR></BLOCKQUOTE>
null -
Java Stored Procedure in EXECUTE IMMEDIATE
Hi,
I need advice for the following.
I'm on Oracle 11g R2. I'm testing application in Oracle 11gR1 and R2 and Oracle Express.
Purpose is to generate XML reports.
I have PLSQL Stored Procedure which does that, but since there is bug in Oracle11gR2 related to XMLTRANSFORM I have and Java Stored Procedure which is workaround. They are both compiled, valid etc.
Java class is :
import java.io.PrintWriter;
import java.io.Writer;
import oracle.xml.parser.v2.DOMParser;
import oracle.xml.parser.v2.XMLDocument;
import oracle.xml.parser.v2.XSLProcessor;
import oracle.xml.parser.v2.XSLStylesheet;
* This class is used as Java stored procedure
* There is a bug on Oracle11gR2, related to the limitation on the number of style sheet instructions
* This stored procedure is workaround when PLSQL code can not be used.
* File must not have package, otherwise is wrongly compiled in DB
public class JavaXslt {
public static void XMLTtransform(oracle.sql.CLOB xmlInput,oracle.sql.CLOB xslInput,oracle.sql.CLOB output) throws Exception{
DOMParser parser;
XMLDocument xml;
XMLDocument xsldoc;
try{
parser = new DOMParser();
parser.parse(xmlInput.getCharacterStream());
xml = parser.getDocument();
parser.parse(xslInput.getCharacterStream());
xsldoc = parser.getDocument();
XSLProcessor processor = new XSLProcessor();
XSLStylesheet xsl = processor.newXSLStylesheet(xsldoc);
Writer w = output.setCharacterStream(1L);
PrintWriter pw = new PrintWriter(w);
processor.processXSL(xsl, xml, pw);
}catch (Exception ex){
throw ex;
PROCEDURE Java_XmlTransform (xml CLOB, xslt CLOB, output CLOB) AS LANGUAGE JAVA
NAME 'JavaXslt.XMLTtransform(oracle.sql.CLOB, oracle.sql.CLOB, oracle.sql.CLOB)';
I'm calling Java stored procedure from PLSQL Stored procedure (if it is Oracle11gR2) like that :
Java_Proc.Java_XmlTransform(inputXML, xslt, res);
So till here everything works ok. XSLT as applied and output XML (res) is OK.
But when Oracle Express is used Java is out of the question, so there is no Java stored procedure. Howewer PLSQL Stored procedure is still needed.
So I had to put call to Java Stored procedure in EXECUTE IMMEDIATE statement in order to compile to PLSQL package.
But when I do that :
EXECUTE IMMEDIATE 'BEGIN Java_Proc.Java_XmlTransform (:1, :2, :3); END;' USING inputXML, xslt, res;
result value CLOB (res) has zero length...
What am I missing? Should i set return value to Java class?
Hope my explanations are clear though.
ThanksHi odie_63,
Thanks for quick response.
I didn't clearly explained.
When using Oracle 11gR1 and Oracle Express I'm using only PLSQL Procedure.
When using Oracle 11gR2 i have to use Java Stored procedure because there is documented bug in R2.
That's why i have to use EXECUTE IMMEDIATE. I don't know which version is the client DB and whether there is or no Java procedures.
I did tried
EXECUTE IMMEDIATE 'BEGIN Java_Proc.Java_XmlTransform (:1, :2, :3); END;' USING IN inputXML, IN xslt, OUT res; and the result was ORA-06537: OUT bind variable bound to an IN position
When using IN OUT for last parameter i.e.
EXECUTE IMMEDIATE 'BEGIN Java_Proc.Java_XmlTransform (:1, :2, :3); END;' USING IN inputXML, IN xslt, IN OUT res;
there is no exception, but still DBMS_LOB.getlength(res) = 0
Thanks -
Size limitation that can be passed to Java stored procedure
Hello!
I enjoy using Oracle8i these days. But I have some questions
about Java stored procedure. I want to pass the XML data to Java
stored procedure as IN parameter. But I got some errors when the
data size is long. Is there any limitation in the data size that
can be passed to Java stored procedure?
Would you please help me ?
This message is long, but would you please read my message?
Contents
1. Outline : I write what I want to do and the error message I
got
2. About the data size boundary: I write about the boundary
size. I found that it depend on which calling sequence I use.
3. The source code of the Java stored procedure
4. The source code of the Java code that call the Java stored
procedure
5. The call spec
6. Environment
1.Outline
I want to pass the XML data to Java stored procedure. But I got
some errors when the data size is long. The error message I got
is below.
[ Error messages and stack trace ]
java.sql.SQLException: ORA-01460: unimplemented or unreasonable
conversion reque
sted
java.sql.SQLException: ORA-01460: unimplemented or unreasonable
conversion reque
sted
at oracle.jdbc.ttc7.TTIoer.processError(Compiled Code)
at oracle.jdbc.ttc7.Oall7.receive(Compiled Code)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(Compiled Code)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch
(TTC7Protocol.java:721
at oracle.jdbc.driver.OracleStatement.doExecuteOther
(Compiled Code)
at oracle.jdbc.driver.OracleStatement.doExecuteWithBatch
(Compiled Code)
at oracle.jdbc.driver.OracleStatement.doExecute(Compiled
Code)
at
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(Compiled
Code
at
oracle.jdbc.driver.OraclePreparedStatement.executeUpdate
(OraclePrepar
edStatement.java:256)
at oracle.jdbc.driver.OraclePreparedStatement.execute
(OraclePreparedStat
ement.java:273)
at javaSp.javaSpTestMain.sample_test
(javaSpTestMain.java:37)
at javaSp.javaSpTestMain.main(javaSpTestMain.java:72)
2. About the data size boundary
I don|ft know the boundary that I got errors exactly, but I
found that the boundary will be changed if I use |gprepareCall("
CALL insertData(?)");|h or |gprepareCall ("begin insertData
(?); end ;")|h.
When I use |gprepareCall(" CALL insertData(?)".
The data size 3931 byte --- No Error
The data size 4045 byte --- Error
Whne I use prepareCall ("begin insertData(?); end ;")
The data size 32612 byte --No Error
The data size 32692 byte --- Error
3. The source code of the Java stored procedure
public class javaSpBytesSample {
public javaSpBytesSample() {
public static int insertData( byte[] xmlDataBytes ) throws
SQLException{
int oraCode =0;
String xmlData = new String(xmlDataBytes);
try{
Connection l_connection; //Database Connection Object
//parse XML Data
dits_parser dp = new dits_parser(xmlData);
//Get data num
int datanum = dp.getElementNum("name");
//insesrt the data
PreparedStatement l_stmt;
for( int i = 0; i < datanum; i++ ){
l_stmt = l_connection.prepareStatement("INSERT INTO test
" +
"(LPID, NAME, SEX) " +
"values(?, ?, ?)");
l_stmt.setString(1,"LIPD_null");
l_stmt.setString(2,dp.getElemntValueByTagName("name",i));
l_stmt.setString(3,dp.getElemntValueByTagName("sex",i));
l_stmt.execute();
l_stmt.close(); //Close the Statement
l_stmt = l_connection.prepareStatement("COMMIT"); //
Commit the changes
l_stmt.execute();
l_stmt.close(); //Close the Statement l_stmt.execute
(); // Execute the Statement
catch(SQLException e ){
System.out.println(e.toString());
return(e.getErrorCode());
return(oraCode);
4. The source code of the Java code that call the Java stored
procedure
public static void sample_test(int num) {
//make data
Patient p = new Patient();
byte[] xmlData = p.generateXMLData(num);
try{
// Load the Oracle JDBC driver
DriverManager.registerDriver(new
oracle.jdbc.driver.OracleDriver());
Connection m_connection = DriverManager.getConnection
("jdbc:oracle:thin:@max:1521:test",
"testuser", "testuser");
CallableStatement l_stmt =
// m_connection.prepareCall(" CALL insertData(?)");
m_connection.prepareCall("begin insertData(?); end
l_stmt.setBytes(1,xmlData);
l_stmt.execute();
l_stmt.close();
System.out.println("SUCCESS to insert data");
catch(SQLException e ){
System.out.println( e.toString());
e.printStackTrace();
5. The call spec
CREATE OR REPLACE PROCEDURE insertData( xmlData IN LONG RAW)
AS
LANGUAGE JAVA NAME 'javaSp.javaSpBytesSample.insertData(byte[])';
6. Environment
OS: Windows NT 4.0 SP3
RDBMS: Oracle 8i Enterprise Edition Release 8.1.5.0.0 for
Windows NT
JDBC Driver: Oracle JDBC Drivers 8.1.5.0.0.
JVM: Java1.1.6_Borland ( The test program that call Java stored
procedure run on this Java VM)
nullIam passing an array of objects from Java to the C
file. The total size of data that Iam sending is
around 1GB. I have to load this data into the Shared
memory after getting it in my C file. Iam working on
HP-UX (64-bit). Everything works fine for around 400MB
of data. When I try to send around 500MB of data, the
disk utilization becomes 100%, so does my memory
utilization and I get a "Not enough space" when I try
to access shared memory. I have allocated nearly 2.5GB
in my SHMMAX variable. Also, I have around 45GB of
disk free. The JVM heap size is also at 2048MB. Where did you get the 400/500 number from? Is that the size of the file?
What do you do with the data? Are you doing nothing but copying it byte for byte into shared memory?
If yes then a simple test is to write a C application that does the same thing. If it has problems then it means you have an environment problem.
If no then you are probably increasing the size of the data by creating a structure to hold it. How much overhead does that add to the size of the data? -
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 -
Error on Java Stored Procedure
I am trying to create a Java Stored Procedure that I will be calling via a trigger on the OP metadata. I have deployed my Java code, created a PL/SQL procedure "AS LANGUAGE JAVA" etc, and verified that the procedure works in a schema on the same instance where the OP schema resides. However, when I try to run the same code in the 'PORTAL30' schema, I get an exception:
ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception: Root of all Java exceptions
ORA-06512: at "PORTAL30.TEST_METHOD", line 0
ORA-06512: at line 1
Now my procedure does to some wacky stuff like run commands in the DOS shell, but I've granted the same set of permissions to both schemas, and it works in one but not in the PORTAL30.
Is there something 'special' about PORTAL30 that I should be aware of when it comes to calling Java Stored Procedures?
Thanks!
- John EmmerWhat is the full error message?
This cannot be setARRAY error.
To connect to Oracle database use this syntax:
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
oConn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE", "<user>", "<user password>");
where
"jdbc:oracle:thin:@localhost:1521:XE" is a JDBC syntax
where "localhost" is Oracle server name or IP address
1521 is a port number of the listener on oracle server (localhost)
XE is a database service
<user> is existing user name - schema owner for your procedure
<user password> is a password for <user>Example:
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
oConn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE", "SCOTT", "TIGER");
...HTH
Thomas -
Error loading Java Stored Procedure
When I attempt to deploy a java stored procedure using JDeveloper I get the following error: "ORA-29545: badly formed class: User has attempted to load a class (TestingJava.Testerama) into a restricted package. Permission can be granted using dbms_java.grant_permission(<user>, LoadClassInPackage...". I have attempted to grant the proper permissions but get a "java.lang.SecurityException: policy table update" error. The user granting the permissions has the Java_Admin role. What do I do?
nullI think u dont've previleges to run
the procedure.
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by arunr12:
hi I am calling java stored procedure from jdbc. i am getting wierd exceptions:
CallableStatement cstmt = conn.prepareCall("begin SEND_MAIL(?,?,?);end;");
cstmt.setString(1,"[email protected]");
cstmt.setString(2,"Mail from Stored Proc");
cstmt.setString(3,"This is test mail from Oracle8i");
cstmt.execute();
i am getting following Exception:
java.sql.SQLException: ORA-29532: Java call terminated by uncaught Java exception: java.security.AccessControlException: the Permission (java.util.PropertyPermission * read,write) has not been granted by dbms_java.grant_permission to SchemaProtectionDomain(ISTORE_CUST|PolicyTableProxy(ISTORE_CUST))
ORA-06512: at "ISTORE_CUST.SEND_MAIL", line 0
ORA-06512: at line 1
<HR></BLOCKQUOTE>
null
Maybe you are looking for
-
my laptop was stolen and with it my itunes, all of my music (including non-apple downloaded content) is still on my iphone 5, how can I transfer the files to my new laptop which is authorised to the same apple ID?
-
Cgicmd.dat not working in 9i Reports 9.0.2
I am trying to configure key mapping. It ws working fine when we were using 6i. but with 9i it just not working please HELP. This url is working fine: http://server:7777/reports/rwservlet?report=tbt1.RDF+userid=user/pwd@connstr+destype=cache+desforma
-
S_ALR_87012357 report - Balance of all company codes
Hi, We are working on a SLO project. We have merged 5 clients systems into 1. totally we have 15 company codes in one client. 0001 company code is for Berlin and it is reflected in T001 table . the T000 table, country field is displaying New york. I
-
I used following code ,still not getting actual value. DATA : DTIME(50) TYPE C. CALL FUNCTION 'FLTP_CHAR_CONVERSION_FROM_SI' EXPORTING CHAR_UNIT = 'FLTP' UNIT_IS_OPTIONAL = ' ' DECIMALS = 15 EXPONENT
-
I have multiple PDF's which were scanned as searchable PDF's. I can search for specific text within these documents using Adobe Reader on my Mac or PC. however I can not see an how I can do this in the iPad app. I can search one open document at a ti