Problems while creating a Java stored proc with dynamic SQL
Hi,
I am trying to write a stored procedure which uses dynamic SQL. The code runs fine outside the database (on DOS PROMPT),but gives me an exception when I try to execute it as a procedure. Could somebody help me out?
The exception given is:
ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception:
java.security.AccessControlException: the Permission (java.net.SocketPermission
elcamino.mcasolutions.com resolve) has not been granted by
dbms_java.grant_permission to SchemaProtectionDomain(SPO|PolicyTableProxy(SPO))
Does it have anything to access permissions to that user?
Thanks in advance!
Joe
Hi:
This store procedure is a Java stored procedure (JSP)?
If true, change your Java code to connect to database because you are connected.
For example:
Connection con = new OracleDriver().defaultConnection();
instead of
Connection con = DriverManager.getConnection(..);
Bye.
J.
Similar Messages
-
Creating a java stored proc in jdev
Does anyone have a quick ref guide to creating a java stored proc in jdev? I am missing early steps to correctly setup the project.
Thanks in advance.Assuming you are using ADF BC, you can try something like the following on your Application Module:
/* our java method to call a stored procedure to send email */
public void sendEmail(String fromEmailAddress, String toEmailAddress,
String subject, String body1, String body2,
String body3, String body4, String body5) {
Object[] parms =
{ fromEmailAddress, toEmailAddress, subject, body1, body2, body3,
body4, body5 };
callStoredProcedure("MSKCC.proc_send_mail(?,?,?,?,?,?,?,?)", parms);
protected void callStoredProcedure(String stmt, Object[] bindVars) {
PreparedStatement st = null;
try {
// 1. Create a JDBC PreparedStatement for
st =
getDBTransaction().createPreparedStatement("begin " + stmt + ";end;", 0);
if (bindVars != null) {
// 2. Loop over values for the bind variables passed in, if any
for (int z = 0; z < bindVars.length; z++) {
// 3. Set the value of each bind variable in the statement
st.setObject(z + 1, bindVars[z]);
// 4. Execute the statement
st.executeUpdate();
} catch (SQLException e) {
throw new JboException(e);
} finally {
if (st != null) {
try {
// 5. Close the statement
st.close();
} catch (SQLException e) {
} -
Writing to a temp table in a stored procedure with dynamic sql
Hi
I am writing into a temp table with dynamic sql:
select coloum_name into #temp_table from
+
@DestinationDBName+'.information_schema.tables
and then I am trying to use #temp_table in the procedure:
select coloum_name into #anotherTable from #temp_table
but I am getting an error that #temp_table is not recognized.
Can a temp table not be used in dynamic sql ?
How can I overcome this problem ?Temp Table Can used easily in Dynamic Query in SQL Server and here is small Exmaple you can check it and do like it
CREATE PROC test
AS
BEGIN
CREATE TABLE #T1
(ID int , NAME Nvarchar(50))
CREATE TABLE #T2
(ID int , NAME Nvarchar(50))
DECLARE @SQL NVARCHAR(MAX)='Insert into #T1
SELECT database_id , Name FROM Sys.Databases
Insert into #T2 Select ID , Name from #T1 '
EXEC SP_ExecuteSQL @SQL
SELECT * FROM #T2
DROP TABLE #T1
DROP TABLE #T2
END
Exec Test
If you found My reply is helpful for you please vote me
thanks
Mustafa EL-Masry
Principle Database Administrator & DB Analyst
SQL Server MCTS-MCITP
M| +966 54 399 0968
MostafaElmasry.Wordpress.Com -
SSRS - Stored procedure with Dynamic SQL Query
Am calling stored procedure in SSRS report. I have used Dynamic SQL query in stored procedure as I don't know the column name and column count. And I have used like below at end of the stored procedure "select * from ##temptable".
As I have used dynamic column, am not able to create report with this stored procedure. Can someone help me out to resolve this issue.
It will be highly appreciated if I get help.
ThanksI have tried everything. But nothing has worked out.
If I get solution for below issue, it would be highly appreciated.
"An error occurred during local report processing.
The definition of the repport 'Main Report' is invalid.
The report defintion is not valid. Details: The report definition has an invalid target namespace 'http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition' which cannot be upgraded.
Thanks
Hello,
I would suggest you post the complete error message to us for further investigation, if you preview the report before you deploy you may get a more detailed error that will help diagnose the source of the problem.
This issue is more related to SQL Server Reporting Services, it's more appropriate to discuss it in the forum below:
https://social.technet.microsoft.com/Forums/sqlserver/en-US/home?forum=sqlreportingservices
Don't forget to elaborate your issue with more detail.
For the manual column, it might be the calculated field in SSRS. Here is the article for your reference, please see:
http://technet.microsoft.com/en-us/library/dd239322(v=sql.110).aspx
Regards,
Elvis Long
TechNet Community Support -
Java stored proc deploy problem
I get follow error,when I deploy Java stored proc with JDeveloper3.2.
Errors:
*** Errors occurred while loading the archive into 8i JVM ***
How can i do?
Thanks a lot!!The problem is with the OUT parameters. If you read the documentation you will see that OUT parameters
need to be declared as one element arrays. Hence this should compile:
CREATE OR REPLACE PROCEDURE TEST ( id IN NUMBER,
i IN NUMBER,
j IN VARCHAR2,
ret1 OUT NUMBER,
ret2 OUT VARCHAR2,
k IN NUMBER) AS
LANGUAGE JAVA NAME 'com.fn.oracle.proc.trading.TestProcedure.testIt(int, double, java.lang.String, int[], java.lang.String[], int)';Cheers, APC -
Problem with java stored procs.
Is there a restriction on accessing XML documents from Java stored procs?
I have a Java program to parse XML document and return a string. If I run this program as a stand alone, the program runs fine.
I loaded the oracle xmlparser.jar into ORACLE8i db sucessfully (used -resolve option). Then I loaded my .class file with -verbose and -resolve option and I did not get any erros. I created function which return string. When I ran the function, I did not get any value bacmk.
Can I use System.out.println in java programs in ORACLE8i. If I can where can I see the output when the program runs? I not waht other mehtods I can use to debug the program running in ORACLE8i JVM.
Thank YouHello again,
I read the documentation of 9i and found some hints about different TCP/IP socket handling of 9i and a standard JVM.
There are some parts that give hints but I couldn't find a sample code to show how to handle the differences.
Could anyone tell me how to handle the differences or give some links to sample code?
Thanks
Detlev -
Problem while creating xml with cdata section
Hi,
I am facing problem while creating xml with cdata section in it. I am using Oracle 10.1.0.4.0 I am writing a stored procedure which accepts a set of input parameters and creates a xml document from them. The code snippet is as follows:
select xmlelement("DOCUMENTS",
xmlagg
(xmlelement
("DOCUMENT",
xmlforest
(m.document_name_txt as "DOCUMENT_NAME_TXT",
m.document_type_cd as "DOCUMENT_TYPE_CD",
'<![cdata[' || m.document_clob_data || ']]>' as "DOCUMENT_CLOB_DATA"
) from table(cast(msg_clob_data_arr as DOCUMENT_CLOB_TBL))m;
msg_clob_data_arr is an input parameter to procedure and DOCUMENT_CLOB_TBL is a pl/sql table of an object containing 3 attributes: first 2 being varchar2 and the 3rd one as CLOB. The xml document this query is generating is as follows:
<DOCUMENTS>
<DOCUMENT>
<DOCUMENT_NAME_TXT>TestName</DOCUMENT_NAME_TXT>
<DOCUMENT_TYPE_CD>BLOB</DOCUMENT_TYPE_CD>
<DOCUMENT_CLOB_DATA>
<![cdata[123456789012345678901234567890123456789012]]>
</DOCUMENT_CLOB_DATA>
</DOCUMENT>
</DOCUMENTS>
The problem is instead of <![cdata[....]]> xmlforest query is encoding everything to give < for cdata tag. How can I overcome this? Please help.SQL> create or replace function XMLCDATA_10103 (elementName varchar2,
2 cdataValue varchar2)
3 return xmltype deterministic
4 as
5 begin
6 return xmltype('<' || elementName || '><![CDATA[' || cdataValue || ']]>
7 end;
8 /
Function created.
SQL> select xmlelement
2 (
3 "Row",
4 xmlcdata_10103('Junk','&<>!%$#&%*&$'),
5 xmlcdata_10103('Name',ENAME),
6 xmlelement("EMPID", EMPNO)
7 ).extract('/*')
8* from emp
SQL> /
<Row>
<Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
<Name><![CDATA[SMITH]]></Name>
<EMPID>7369</EMPID>
</Row>
<Row>
<Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
<Name><![CDATA[ALLEN]]></Name>
<EMPID>7499</EMPID>
</Row>
<Row>
<Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
<Name><![CDATA[WARD]]></Name>
<EMPID>7521</EMPID>
</Row>
<Row>
<Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
<Name><![CDATA[JONES]]></Name>
<EMPID>7566</EMPID>
</Row>
<Row>
<Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
<Name><![CDATA[MARTIN]]></Name>
<EMPID>7654</EMPID>
</Row>
<Row>
<Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
<Name><![CDATA[BLAKE]]></Name>
<EMPID>7698</EMPID>
</Row>
<Row>
<Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
<Name><![CDATA[CLARK]]></Name>
<EMPID>7782</EMPID>
</Row>
<Row>
<Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
<Name><![CDATA[SCOTT]]></Name>
<EMPID>7788</EMPID>
</Row>
<Row>
<Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
<Name><![CDATA[KING]]></Name>
<EMPID>7839</EMPID>
</Row>
<Row>
<Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
<Name><![CDATA[TURNER]]></Name>
<EMPID>7844</EMPID>
</Row>
<Row>
<Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
<Name><![CDATA[ADAMS]]></Name>
<EMPID>7876</EMPID>
</Row>
<Row>
<Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
<Name><![CDATA[JAMES]]></Name>
<EMPID>7900</EMPID>
</Row>
<Row>
<Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
<Name><![CDATA[FORD]]></Name>
<EMPID>7902</EMPID>
</Row>
<Row>
<Junk><![CDATA[&<>!%$#&%*&$]]></Junk>
<Name><![CDATA[MILLER]]></Name>
<EMPID>7934</EMPID>
</Row>
14 rows selected.
SQL> -
Problem while Creating MVLOG with synonym in Oracle 9i:Is it an Oracle Bug?
Hi All,
I am facing a problem while Creating MVLOG with synonym in Oracle 9i but for 10G it is working fine. Is it an Oracle Bug? or i am missing something.
SQL> select * from v$version;
BANNER
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
SQL>
SQL> create table t ( name varchar2(20), id varchar2(1) primary key);
Table created.
SQL> create materialized view log on t;
Materialized view log created.
SQL> create public synonym syn_t for t;
Synonym created.
SQL> CREATE MATERIALIZED VIEW MV_t
2 REFRESH ON DEMAND
3 WITH PRIMARY KEY
4 AS
5 SELECT name,id
6 FROM syn_t;
Materialized view created.
SQL> CREATE MATERIALIZED VIEW LOG ON MV_t
2 WITH PRIMARY KEY
3 (name)
4 INCLUDING NEW VALUES;
Materialized view log created.
SQL> select * from v$version;
BANNER
Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production
PL/SQL Release 9.2.0.6.0 - Production
CORE 9.2.0.6.0 Production
TNS for Solaris: Version 9.2.0.6.0 - Production
NLSRTL Version 9.2.0.6.0 - Production
SQL>
SQL> create table t ( name varchar2(20), id varchar2(1) primary key);
Table created.
SQL> create materialized view log on t;
Materialized view log created.
SQL> create public synonym syn_t for t;
Synonym created.
SQL> CREATE MATERIALIZED VIEW MV_t
REFRESH ON DEMAND
WITH PRIMARY KEY
AS
2 3 4 5 SELECT name,id
FROM syn_t; 6
Materialized view created.
SQL> CREATE MATERIALIZED VIEW LOG ON MV_t
WITH PRIMARY KEY
(name)
INCLUDING NEW VALUES; 2 3 4
CREATE MATERIALIZED VIEW LOG ON MV_t
ERROR at line 1:
ORA-12014: table 'MV_T' does not contain a primary key constraintRegards
Message was edited by:
Avinash Tripathi
nullHi Nicloei,
Thanks for the reply. Actually i don't want any work around (Creating MVLOG on table rather than synonym is fine with me) . I just wanted to know it is actually an oracle bug or something else.
Regards
Avinash -
Hi all, i'm new to Mac book & Xcode. I'm learning and facing problems while creating a new file for Xcode. Before i upgrade the software, i have no issue to create simple steps in apps. After upgrade Xcode to 4.6 version, i'm facing lot's of issue eg.
1) "the identity "iphone developer" doesn't match any valid certificate/ private key pair",
2) can't select the box "with XIB for user interface" if the subclass is "UIViewController"..
Appreciate for any help rendered.Mikko777 wrote:So what is the best?
I wouldn't judge. I've been to Arch for a week, you know? But as said, it's VERY close to it.
What I dislike after a week is makepkg not handling dependencies automatically (which would be overhead, so probably not appropriate).
Mikko777 wrote:Also theres KDEmod for modular kde, dunno if its for 64 bits tho.
Don't actually need that as said ... I see no real benefit of having that other than not beeing a KDE user or having Gentoos useflags.
Mikko777 wrote:PS:You produce a lot of text and welcome smile
Yeah. Wonder why I'm still employed? So do I ... -
hello.
What would trigger the change of "STATUS" from valid to invalid
for a java stored procedure (status of the PROCEDURE, not the
java class/source)?
E.g.
- loaded a java source/class
- published it with CREATE PROCEDURE ...
- the procedure inserts a row into some table X
- select* from user_objects where object_type = 'PROCEDURE'; shows that
the proc is valid
- call the proc, fine
- delete a column from the table X
- select* from user_objects where object_type = 'PROCEDURE'; shows that
the proc is still VALID
- call the proc, the call actually completed without error! (but the new row didn't get inserted into the table)
When the schema of a table that a java stored proc refers
to changes, will the java stored proc automatically marked
as "INVALID"? If not, when will this status changed from
VALID to INVALID?
Thanks.
MinMin:
A java stored procedure is marked as VALID or INVALID depending on whether Oracle had any problems loading the class file into the database. Since you had no problems loading the class file it will always be valid.
Now, after you deleted the column in the table I would assume that the java stored procedure would have a problem when it tried to do an insert and it would throw an exception. Your java stored procedure is VALID, it just isn't executing properly and is more than likely throwing an exception.
Sometimes an exception thrown from a jsp is written to a log file instead of to the console. I suspect that this is the case in your situation. You think that the call to the jsp executed with no errors, but I bet it didn't. You will probably find the errors somewhere in the oracle\ora90\admin\mydatabase directory. Look at the latest .trc file. (Note: the path I gave to the .trc files may be different depending on what version of oracle you are using). -
Java Stored Proc, passing BLOB, not stored in a table.
I have checked this article, and found it will not suit my needs.
http://otn.oracle.com/sample_code/tech/java/codesnippet/jdbc/lob/LobToSP.html
I have even looked at the 4 articles on the "JSP How-To Documents" page.
I need to pass in a BLOB to my Java Stored proc, but not store it in the DB - My java code manipulates the LOB and it should never go into the DB. I know I could do the normal store, get an id and pass to my JSP... but that is a poor way to implement this. Are there any code samples on how to do this please ?
DWOW! That seems like a very bad design.
Is it just the compiler that has the problem or is the PL/SQL code inside the stored procedure also affected? For example, if I'm doing an
EXECUTE IMMEDIATE 'insert ... INTO OtherSchema.tblTest';
Is this going to be a problem?
The problem with granting the access explicitly is the Archive Schema, which has the stored procedure that is failing, might not exist at the time when the other schemas are created. Therefore, there is no user to grant permissions to. I solved this by granting permissions to the role and when the archive user is created it is assigned that role.
This seems like the proper way to solve this problem. -
Can't execute OS-level command from java stored proc
I've written a couple simple java stored procs, the first of which writes an file and the second attempts a chown on it. I can write the file (which is written as the oracle user) just fine. I need to chown it, but can't. Here's the first proc:
public static String writefile()
String fileName = "/joetest/test.xml";
try {
File f = new File(fileName);
FileOutputStream out = new FileOutputStream(f);
PrintStream p = new PrintStream(out);
p.println("this is only a test");
p.close();
return "create file successful!!!";
} catch (Exception e) {
return "Exception occurred writing file:"+e;
Here's the proc I've been stuggling with:
public static String chown(String inString)
String[] command = {"/bin/sh", "-c", "/usr/bin/chown notjoe /joetest/test.xml"};
if (inString != null) {
command[2] = inString;
try {
Process p = Runtime.getRuntime().exec(command);
return "Ownership change success!! "+p;
} catch (Exception e) {
return "Ownership change failure?? err="+e;
The package is created with:
CREATE OR REPLACE PACKAGE JOE.THISISATEST AS
FUNCTION writefile
return VARCHAR2
AS
LANGUAGE java
NAME 'thisisatest.writefile() return java.lang.String';
FUNCTION chown(Param1 VARCHAR2)
return VARCHAR2
AS
LANGUAGE java
NAME 'thisisatest.chown(java.lang.String) return java.lang.String';
end;
And I've granted the following privileges:
begin
dbms_java.grant_permission('JOE', 'java.io.FilePermission', '/joetest/test.xml', 'read, write, execute, delete');
end;
begin
dbms_java.grant_permission('JOE', 'java.io.FilePermission', '/usr/bin/chown', 'execute');
end;
begin
dbms_java.grant_permission('JOE', 'SYS:java.lang.RuntimePermission', 'writeFileDescriptor', '');
end;
begin
dbms_java.grant_permission('JOE', 'SYS:java.lang.RuntimePermission', 'readFileDescriptor', '');
end;
Here's the error that I'm getting:
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
Coincidentally, this is the same error that I used to get when I wrote the file without having been granted write privileges. Once I granted myself the proper 'write' permissions I could perform file IO just fine. Is there some runtime permission that I need to grant myself to run chown? I'm just guessing, as I can't find any permission like that in the java documentation. I have 'execute' permission on /usr/bin/chown and the oracle user can execute the command I'm attempting from the command line. ARRRRRGH.
I am at my wits end with this. I've tried what seems like a thousand different syntaxes for the OS command and ran it from many different directories. Anyone have any thoughts at all as to why this is happening? I'm just clutching at straws now...Hmmmm. Granting 'execute' on '<<ALL FILES>>' to user JOE fixes this problem:
begin
dbms_java.grant_permission('JOE', 'java.io.FilePermission', '<<ALL FILES>>', 'execute');
end;
My security folks will not allow this when I port to production, but at least it is something.
Message was edited by:
user603023 -
Calling an EJB deployed in OC4J from Java Stored Proc in Oracle
Hello!
Trying to make a call to an EJB deployed in OCJ4 from a oracle java stored proc. After loaded orion.jar and crimson.jar lib into SCOTT schema, I can't get the JNDI Context working because of this error:
============================================
javax.naming.NoInitialContextException: Cannot instantiate class:
com.evermind.server.ApplicationClientInitialContextFactory. Root exception is
java.lang.ClassNotFoundException:
com/evermind/server/ApplicationClientInitialContextFactory
at java.lang.Class.forName0(Class.java)
at java.lang.Class.forName(Class.java)
at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:45)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java)
at javax.naming.InitialContext.init(InitialContext.java)
at javax.naming.InitialContext.<init>(InitialContext.java)
===============================
I did load the java with "loadjava" with on time with the "resolve" option and time time no option and still no working.
Here is the EJB client code:
=======================================
import java.sql.*;
import java.util.*;
import javax.naming.*;
import com.evermind.server.ApplicationClientInitialContextFactory;
class EmpRemoteCall {
public static void main(String[] args) {
System.out.println(getEmpName());
public static String getEmpName() {
String ejbUrl = "java:comp/env/ejb/Emp";
String username = "admin";
String password = "admin";
Hashtable environment = new Hashtable();
environment.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.ApplicationClientInitialContextFactory");
environment.put(Context.PROVIDER_URL, "ormi://127.0.0.1/testemp");
environment.put(Context.SECURITY_PRINCIPAL, username);
environment.put(Context.SECURITY_CREDENTIALS, password);
//environment.put(Context.SECURITY_AUTHENTICATION, ServiceCtx.NON_SSL_LOGIN);
//environment.put(javax.naming.Context.URL_PKG_PREFIXES, "oracle.aurora.jndi");
com.kboum.sertir.essais.EmpHome homeInterface = null;
try {
Class.forName("com.evermind.server.ApplicationClientInitialContextFactory", true, ClassLoader.getSystemClassLoader());
System.out.println("Creating an initial context");
Context ic = new InitialContext(environment);
System.out.println("Looking for the EJB published as 'java:comp/env/ejb/Emp'");
homeInterface = (com.kboum.sertir.essais.EmpHome) ic.lookup(ejbUrl);
catch (CommunicationException e) {
System.out.println("Unable to connect: " + ejbUrl);
e.printStackTrace();
//System.exit(1);
catch (NamingException e) {
System.out.println("Exception occurred!");
System.out.println("Cause: This may be an unknown URL, or some" +
" classes required by the EJB are missing from your classpath.");
System.out.println("Suggestion: Check the components of the URL," +
" and make sure your project includes a library containing the" +
" EJB .jar files generated by the deployment utility.");
e.printStackTrace();
//System.exit(1);
catch (ClassNotFoundException e) {
System.out.println("Unable to connect: " + ejbUrl);
e.printStackTrace();
//System.exit(1);
try {
System.out.println("Creating a new EJB instance");
com.kboum.sertir.essais.Emp remoteInterface = homeInterface.findByPrimaryKey(Integer.valueOf("7369"));
System.out.println(remoteInterface.getENAME());
System.out.println(remoteInterface.getSAL());
remoteInterface.setSAL(2);
System.out.println(remoteInterface.getSAL());
return remoteInterface.getENAME();
catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
return "error";
nullWhat I did to solve this problem was to
create a simple RMI remote object that
resides outside the database JVM and that
serves as a proxy EJB client for your java
stored procedure. The stored procedure can
invoke a method on the remote RMI object
which then looks up the EJBean's home
interface and invokes the relevant method on
the bean's remote interface, and relays any
return values back to the java stored
procedure.
Hope this helps,
Avi.
null -
Parse XML in a java stored proc
I am trying to parse an xml document in a java stored procedure. Just following my nose, I have developed a stored proc that works fine in development (outside the database using JRE 1.4.1) using the Xerces 2.5 parser. But, after having transferred the xerces xercesImpl.jar, xmlapis.jar, and my implementation class into oracle using loadjava when I call my stored proc the code throws an exception trying to build the document with an error like:
NoClassDef exception org.apache.xerces.jaxp.DocumentFactoryBuilderImpl
My Code looks like this:
import java.io.IOException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
InputStream is = getXMLAsInputStream(xml);
try {
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse( is );
... parse the document ....
catch (FactoryConfigurationError e) {
// unable to get a document builder factory
The exception caught is a FactoryConfigurtionError.
I'm not particularly attached to xerces, I'm really just looking for a way to parse XML inside my java stored proc, so any help to solve my problem, or an alternative suggestion will be greatly appreciated.
thanks
DaleI looked again and sure enough the xerces implementation classes were missing. I had run a .cmd file containing these two lines, but it looks like only the first one ran...
loadjava -u ncc/xyz@usd -v -r M:\Database\JavaGeocode\Xerces2_5_0\xml-apis.jar
loadjava -u ncc/xyz@usd -v -r M:\Database\JavaGeocode\Xerces2_5_0\xercesImpl.jar
Now I've got everything working fine with Xerces!
Dale -
Java stored proc from proxy Java classes generated from a web service?
Hi gurus,
I have searched "Java Stored Procedure" on this forum but could not find what I am looking for, so I have to post again.
I need to use a web service and my client app is written in PowerBuilder 11 (Sybase), which claims that it will create a datawindow from a web service. Well, it turned out that PB can only handle simple stuff (it works with a very simple wsdl from the internet) but can't handle more complex ones that we need to use. So I am thinking about using Oracle JDeveloper(JDev) to create the web service proxy for the web service and then load it into Oracle as a Java stored procedure so that PowerBuilder can call the procedure. JDev succsfully generated the proxy and a few Java classes. My question is, do I need to load all the classes into the database? If yes, will the reference to the package work? For example, in a JDev generated class (the soap client class), it has package MyJdev.proxy; at the top. Or, will it work if I load all the classes included in package /MyJdev/proxy into the database?
Thank you very much for any help.
BenFor the java stored proc called from pl/sql, the example above that uses dynamic sql should word :
CREATE OR REPLACE PACKAGE MyPackage AS
TYPE Ref_Cursor_t IS REF CURSOR;
FUNCTION get_good_ids RETURN VARCHAR2 ;
FUNCTION get_plsql_table_A RETURN Ref_Cursor_t;
END MyPackage;
CREATE OR REPLACE PACKAGE BODY MyPackage AS
FUNCTION get_good_ids RETURN VARCHAR2
AS LANGUAGE JAVA
NAME 'MyServer.getGoodIds() return java.lang.String';
FUNCTION get_plsql_table_A RETURN Ref_Cursor_t
IS table_cursor Ref_Cursor_t;
good_ids VARCHAR2(100);
BEGIN
good_ids := get_good_ids();
OPEN table_cursor FOR 'SELECT id, name FROM TableA WHERE id IN ( ' | | good_ids | | ')';
RETURN table_cursor;
END;
END MyPackage;
public class MyServer{
public static String getGoodIds() throws SQLException {
return "1, 3, 6 ";
null
Maybe you are looking for
-
In A3, How Do I Apply One Of My (many) Custom Metadata Views To The Viewer?
In A3, it appears that both the Viewer and Browser are limited to just 2 views: Basic and Expanded. In A2, I had many custom metadata views that I could easily change via the Metadata-pane (now gone) in Prefs. depending on the type of workflow, custo
-
Is it possible to create an accessible text record of the bookmarks in a pdf
I am using Adobe 9.0 0. My pdf has a large number of bookmarks, which I want to check against other sources. I wish to create a list that I can copy and paste elsewhere.
-
How to access the MBeans in the WLS 7.0
Hi I have to access MBeans in the WLS7.0 using Management API (weblogic.management.*). Anyone could you tell me asap Regards Bala
-
Using IndexedColorModel with a non rgb colorspace
Hi, I am trying to create an image for which I have an ICC colorspace defined, the raster of pixels and the IndexedColorMap. The Java indexedCOlorModel only appears to work with srgb. How can I put these elements togerther to create a BufferedImage.
-
What happens after card reset (from JCRE perspective)?
Hi, In windows environment, to keep state of application, i cam imagine that data is serialized and saved to a text file. On second app invocation, the data from text file is reloaded to reconstruct objects and form the last state of application. In