XML SQL Utility:Why it doesn't work?
I am trying to use the XML SQL Utility
by modifying the given example samp1.java
for the JDBC-ODBC driver but errors emerged.
Is there any thing wrong? Thanks.
(The classpath setting is ok, I think)
***** Here is the error message:
D:\OracleXSU\sample>java Sample
Exception in thread "main" java.lang.NoClassDefFoundError: oracle/sql/Datum
at oracle.xml.sql.query.OracleXMLQuery.<init>(OracleXMLQuery.java:127)
at Sample.main(Sample.java:42)
D:\OracleXSU\sample>
***** Here is the source code:
/** Simple example on using Oracle XMLSQL API; this class queries the database with "select * from emp" in scott/tiger schema; then from the results of query it generates an XML document */
import java.sql.*;
import java.math.*;
import oracle.xml.sql.query.*;
// import oracle.jdbc.*;
// import oracle.jdbc.driver.*;
public class Sample
//========================================
// main() - public static void
public static void main(String args[]) throws SQLException
String tabName = "sbook";
String user = "scott/tiger";
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
// DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
//init a JDBC connection
// Connection conn =
// DriverManager.getConnection("jdbc:oracle:oci8:"+user+"@");
Connection conn = DriverManager.getConnection("jdbc:odbc:SQLUtil");
// create statement and execute it to get the ResultSet
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery("select * from "+tabName );
if(rset!=null)
// init the OracleXMLQuery; note we could have passed the sql query string
// instead of the ResultSet
OracleXMLQuery qry = new OracleXMLQuery(conn,rset);
// get the XML document is the string format
String xmlString = qry.getXMLString();
// print out the result
System.out.println(" OUPUT IS:\n"+xmlString);
null
Firstly I think it is because the XML SQL Utility does not work with JDBC-ODBC driver.
So I try it again with Oracle driver.
But it still doesn't work? Why?
***** Here is the source code:
/** Simple example on using Oracle XMLSQL API; this class queries the database with "select * from emp" in scott/tiger schema; then from the results of query it generates an XML document */
import java.sql.*;
import java.math.*;
import oracle.xml.sql.query.*;
import oracle.jdbc.*;
import oracle.jdbc.driver.*;
public class Sample2
//========================================
// main() - public static void
public static void main(String args[]) throws SQLException
String tabName = "emp";
String user = "scott/tiger";
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
//init a JDBC connection
// Connection conn =
// DriverManager.getConnection("jdbc:oracle:oci8:"+user+"@");
//init a JDBC connection
Connection conn = DriverManager.getConnection ("...Connection information...");
// create statement and execute it to get the ResultSet
Statement stmt = conn.createStatement();
// ResultSet rset = stmt.executeQuery("select * from "+tabName );
ResultSet rset = stmt.executeQuery("select * from COFFEES" );
// Test if connection is sucessful -- it works!
int i=0;
while(rset.next())
i++;
System.out.println("Total rows="+i);
// init the OracleXMLQuery; note we could have passed the sql query string
// instead of the ResultSet
OracleXMLQuery qry = new OracleXMLQuery(conn,rset);
// get the XML document is the string format
String xmlString = qry.getXMLString();
// print out the result
System.out.println(" OUPUT IS:\n"+xmlString);
null
Similar Messages
-
XML SQL Utility, Unicode
Hi,
I have some questions to the XML-SQL-Utility:
1.) Is there a bug in the oracle.xml.sql.query class:
OracleXMLQuery qry = new OracleXMLQuery(conn,"select POSITION from DATAS");
qry.setRowTag("DROW");
OracleXMLDocGenDOM gdoc = new OracleXMLDocGenDOM();
qry.getXML(gdoc);
conn.close();
Document docin = gdoc.getXMLDocumentDOM();
NodeList rows = docin.getDocumentElement().getElementsByTagName("DROW");
// The Node "DROW" wasn't found.
// It work if I do it below
NodeList rows = docin.getDocumentElement().getElementsByTagName("ROW");
// It doesn't matter what is set in the "qry1.setRowTag("DROW");"
(I use the sun parser)
2.) I have a problem by insertXML(Document);
I will insert a Document with a structure as below in my database:
<?xml version="1.0" encoding="UTF-16"?>
<ROOTDOC>
<ROW>
<DOCUMENTREF>133-12224</DOCUMENTREF>
<TEXT>hello</TEXT>
</ROW>
<ROW>
<DOCUMENTREF>133-124</DOCUMENTREF>
<TEXT>world</TEXT>
</ROW>
</ROOTDOC>
XmlDocument sdoc = new XmlDocument();
Element rootDEl = sdoc.createElement("ROOTDOC");
sdoc. appendChild(rootDEl);
Element rowEl = sdoc.createElement("ROW");
Element docREl = sdoc.createElement("DOCUMENTREF");
docREl.appendChild(sdoc.createTextNode("133-12224"));
NodeList rows = sdoc.getDocumentElement().getElementsByTagName("ROW");
int size = rows.getLength();
System.out.println("SIZE: " size "\n");
// The size is null, what's wrong ?
OracleXMLSave save = new OracleXMLSave(conn, tabName);
int rowCount = save.insertXML(sdoc);
// It didn't insert something in my table !
3.) I save Unicode UTF-16 in my database with the XML SQL Utility:
<?xml version="1.0" encoding="UTF-16"?>
<ROOTDOC>
<ROW>
<TEXT>D$55DD</TEXT>
</ROW>
<ROW>
<TEXT>tt%zu||</TEXT>
If I read it whit the oracle.xml.sql.query, it is Unicode UTF-8:
OUTPUT IS:
<?xml version="1.0"?>
<ROOTDOC>
<ROW num="1">
<TEXT>D$55--</TEXT>
</ROW>
<ROW num="2">
<TEXT>tt%zu33</TEXT>
</ROW>
I want a output as the input (Unicode UTF-16).
Can anyone please advise on the problems.
Thanks
nullHi H.Ozawa,
thanks for trying but non of the solution helped me, sorry.
Question 1:
I'll try it again like this:
OracleXMLQuery qry = new OracleXMLQuery(conn,"select POSITION from DATAS");
qry.setRowTag("DROW");
Document docin = qry.getXMLDOM();
conn.close();
NodeList rows = docin.getDocumentElement().getElementsByTagName("DROW");
// The Node "DROW" wasn't found.
Question 2:
<?xml version="1.0" encoding="UTF-16"?>
<ROOTDOC>
<ROW>
<DOCUMENTREF>133-12224</DOCUMENTREF>
<TEXT>hello</TEXT>
</ROW>
<ROW>
<DOCUMENTREF>133-124</DOCUMENTREF>
<TEXT>world</TEXT>
</ROW>
</ROOTDOC>
XmlDocument sdoc = new XmlDocument();
Element rootDEl = sdoc.createElement("ROOTDOC");
sdoc. appendChild(rootDEl);
Element rowEl = sdoc.createElement("ROW");
Element docREl = sdoc.createElement("DOCUMENTREF");
docREl.appendChild(sdoc.createTextNode("133-12224"));
Element docTEl = sdoc.createElement("TEXT");
docTEl.appendChild(sdoc.createTextNode("hello"));
An error message occur:
java.lang.reflect.InvocationTargetException: java.lang.IllegalAccessError: try to access class com/sun/xml/tree/ParentNode from class project/dbase/xmlwritedb at project.dbase.xmlwritedb.main(xmlwritedb.java:33)
at java.lang.reflect.Method.invoke(Native Method)
at com.borland.jbuilder.util.BootStrap.invokeMain(Unknown Source)
at com.borland.jbuilder.util.BootStrap.main(Unknown Source)
Question 3:
I try it like below but the output is "UTF-8" encoding
OracleXMLDocGenDOM gdoc = new OracleXMLDocGenDOM();
query.getXML(gdoc);
XMLDocument docin = (XMLDocument)gdoc.getXMLDocumentDOM();
docin.setEncoding("ISO-8859-1"); //docin.setEncoding("UTF-16");
NodeList rows = docin.getDocumentElement().getElementsByTagName("ROW");
Element row = (Element)rows.item( i );
NodeList elements = row.getElementsByTagName( "DOCUMENTREF" );
So you or someone have another idea to fix this problems.
Thanks
null -
XML SQL Utility - settagcase - all tags are upper or lower
I am using the XML SQL Utility (XSU) for PL/SQL to generate a xml document from some tables and objects. Is it possible to have the xml elements start and end tags appear in the case of the objects I have defined (i.e. CamelCase)? I can either have them appear as all upper or all lower case. However the oracle documentation has a SETTAGCASE function with an option for "as are". Is this supposed to allow for the case to follow how i have defined the fields in the object? If not is there a way?
For example here is an object
create or replace TYPE CREDIT_APPLICANTTYPE AS OBJECT
First VARCHAR2(15 BYTE),
Last VARCHAR2(35 BYTE),
Middle VARCHAR2(1 BYTE),
Suffix VARCHAR2(3 BYTE)
);Settagcase 0 option doesn't seem to do anything different than the upper_case option when i generate the xml
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_xmlque.htm#i1033636
set serveroutput on
declare
queryCtx dbms_xmlquery.ctxType;
charstring VARCHAR2(255);
outxml CLOB;
begin
queryCtx := dbms_xmlquery.newContext('select CREDIT_APPLICANTTYPE(''Joe'',''Smith'',''A'',''Jr.'') as AppName from dual');
dbms_xmlquery.settagcase(queryCtx, 0);
outxml := dbms_xmlquery.getXml(queryCtx);
dbms_xmlquery.closeContext(queryCtx);
charstring := dbms_lob.substr(outxml, 255, 1);
dbms_output.put_line(charString);
end;Output is in uppercase but i would like camel case:
<?xml version = '1.0'?>
<ROWSET>
<ROW num="1">
<APPNAME>
<FIRST>Joe</FIRST>
<LAST>Smith</LAST>
<MIDDLE>A</MIDDLE>
<SUFFIX>Jr.</SUFFIX>
</APPNAME>
</ROW>
</ROWSET>Actually I figured out the issue. Oracle automatically outputs the column alias as upper case unless you put it in quotes. I defined my object like this and it works with settagcase 0
create or replace TYPE CREDIT_APPLICANTTYPE AS OBJECT
"First" VARCHAR2(15 BYTE),
"Last" VARCHAR2(35 BYTE),
"Middle" VARCHAR2(1 BYTE),
"Suffix" VARCHAR2(3 BYTE)
); -
XML SQL Utility - OracleXMLStore?
I am stepping thru the release notes for the "Oracle XML SQL
Utility for Java". I have incorporated the env.csh into my
.cshrc file as shown below. I am currently trying to "Load the
Oracle XML SQL Utility for Java into an Oracle DB". I am having
problems running the oraclexmlsqlload.csh. It seems to run
@xmlgenpkg.sql without errors; however, the
@oraclexmlsqltest.sql produces the following error:
ERROR at line 1
class OracleXMLStore does not exist
at SCOTT.XMLGEN line 32
at line 38
class OracleXMLStore does not exist
Here is my .cshrc file
# @(#)cshrc 1.11 89/11/29 SMI
umask 022
set path=( /bin /usr/bin /usr/ucb /etc /usr/openwin/bin
/usr/local/bin /usr/sbin /usr/ccs/bin .)
if ( $?prompt ) then
set history=32
endif
#setenv ORACLE_HOME /usr/oracle-home
setenv ORACLE_BASE /usr/oracle
setenv ORACLE_HOME /usr/oracle/8.1.5
set path = ( $path $ORACLE_HOME/bin )
#setenv PATH $PATH:$ORACLE_HOME/bin:/usr/openwin/bin:/usr/sbin
setenv LD_LIBRARY_PATH $ORACLE_HOME/lib
setenv ORACLE_SID p
setenv ORA_NLS33 $ORACLE_HOME/ocommon/nls/admin/data
setenv PD $ORACLE_HOME/OracleXSU
setenv CLASSPATHJ $ORACLE_HOME/jdbc/lib/classes111.zip
setenv XMLSQL_DIR $PD/lib/oraclexmlsql.jar:$PD
setenv ORACLE_PARSER $PD/lib/xmlparser.jar
setenv JDK_HOME /usr/java1.1
set CLASSPATH = ($ORACLE_PARSER $CLASSPATHJ $JDK_HOME
$XMLSQL_DIR)
setenv TNS_ADMIN $ORACLE_HOME/network/admin
setenv ORACLE_TERM sun5
echo 'Running .cshrc...'
alias ls ls -F
nullOracle XML Team,
After running the initjvm script and re-executing
oraclexmlsqlload, no errors occurred. Also, the sample java
files which come with the kit worked correctly. Thanks for all
the help that you have provided. The support was fantastic!
Oracle XML Team wrote:
: Hello Ron,
: It sounds more and more like your db is not java enabled. To
: java enable it connect to it using server manager as internal
and
: then run the initjvm script (goto javavm/install directory and
: you should see the initjvm script). The other option which
would
: make life easier is for you to contact your dba. Let me know
how
: things go.
: Ron Newby (guest) wrote:
: : Ahhhh, executing the script with csh started several
loading...
: : and creating... commands; however, an error did occur:
: : Creating xmlparser _2.0.0.1.0_beta
: : Error creating xmlparser _2.0.0.1.0_beta
: : ORA-29547 Java system class not available
: : oracle/aurora/rdbms/Compiler
: : After this error, several "ORA-29534 referenced object...
could
: : not be resolved" errors occured.
: : Oracle XML Team wrote:
: : : Your db might be already java initialized (if not, please
: : look
: : : at your documentation on how to do this). One problem that
I
: : did
: : : notice is that you are trying to execute a csh script in
sh.
: : : Please try
: : : $ csh oraclexmlsqlload.csh
: : : or
: : : $ tcsh oraclexmlsqlload.csh
: : : Let me know the outcome.
: : : Ron Newby (guest) wrote:
: : : : After a closer look at the output from running
: : : oraclexmlsqlload,
: : : : it doesn't look like the loadjava worked correctly. We
are
: : : : running Oracle 8.1.5. What is required to make the db
java
: : : : enabled? I have run the examples using the thin driver
: which
: : : : worked correctly. Below are the results of running
: : : : oraclexmlsqlload.csh.
: : : : $ sh oraclexmlsqlload.csh
: : : : Loading jar files...
: : : : Loading xmlparser...
: : : : loadjava: Usage: loadjava [-user user/password@database]
: : [-oci8
: : : |
: : : : -thin] [-help]
: : : : [-verbose] [-resolve] [-andresolve] [-force] [-synonym]
: : : : [-definer] [-resolver r
: : : : esolver] [-grant user,user...] [-schema schema] [-debug]
: : : : [-oracleresolver] class
: : : : es..jars..resources..properties...
: : : : Loading oraclexmlsql.jar...
: : : : loadjava: Usage: loadjava [-user user/password@database]
: : [-oci8
: : : |
: : : : -thin] [-help]
: : : : [-verbose] [-resolve] [-andresolve] [-force] [-synonym]
: : : : [-definer] [-resolver r
: : : : esolver] [-grant user,user...] [-schema schema] [-debug]
: : : : [-oracleresolver] class
: : : : es..jars..resources..properties...
: : : : Cleaning up...
: : : : dropjava: Usage: dropjava [-user user/password@database]
: : [-oci8
: : : |
: : : : -thin] [-help]
: : : : [-verbose] [-schema schema] [-debug]
: : : : classes..jars..resources..properties...
: : : : Completed loading classes
: : : : Creating functions...
: : : : SQL*Plus: Release 8.1.5.0.0 - Production on Fri Nov 26
: : 10:03:37
: : : : 1999
: : : : (c) Copyright 1999 Oracle Corporation. All rights
: reserved.
: : : : Enter password:
: : : : Oracle XML Team wrote:
: : : : : Hi Ron.
: : : : : Before creating the xmlgen pkg, oraclexmlsqlload.csh
: : tries
: : : to
: : : : : load the oracle xml parser and the oraclexmlsql.jar
into
: : your
: : : : db
: : : : : (i.e. it does a "loadjava..."). Is that part finishing
: : : : properly?
: : : : : Realize that to be able to run the utility within the
: db
: : : you
: : : : : need to have at least Oracle 8.1.5 and have it java
: : enabled.
: : : : If
: : : : : you don't have this you can always run the utility as a
: : : client
: : : : : connecting via the Oracle JDBC1.22 compliant drivers.
: : : : : Ron Newby (guest) wrote:
: : : : : : I am stepping thru the release notes for the "Oracle
: XML
: : : SQL
: : : : : : Utility for Java". I have incorporated the env.csh
: into
: : my
: : : : : : .cshrc file as shown below. I am currently trying to
: : "Load
: : : : the
: : : : : : Oracle XML SQL Utility for Java into an Oracle DB".
I
: am
: : : : : having
: : : : : : problems running the oraclexmlsqlload.csh. It seems
to
: : run
: : : : : : @xmlgenpkg.sql without errors; however, the
: : : : : : @oraclexmlsqltest.sql produces the following error:
: : : : : : ERROR at line 1
: : : : : : class OracleXMLStore does not exist
: : : : : : at SCOTT.XMLGEN line 32
: : : : : : at line 38
: : : : : : class OracleXMLStore does not exist
: : : : : : Here is my .cshrc file
: : : : : : # @(#)cshrc 1.11 89/11/29 SMI
: : : : : : umask 022
: : : : : : set path=( /bin /usr/bin /usr/ucb /etc
/usr/openwin/bin
: : : : : : /usr/local/bin /usr/sbin /usr/ccs/bin .)
: : : : : : if ( $?prompt ) then
: : : : : : set history=32
: : : : : : endif
: : : : : : #setenv ORACLE_HOME /usr/oracle-home
: : : : : : setenv ORACLE_BASE /usr/oracle
: : : : : : setenv ORACLE_HOME /usr/oracle/8.1.5
: : : : : : set path = ( $path $ORACLE_HOME/bin )
: : : : : : #setenv PATH
: : : : $PATH:$ORACLE_HOME/bin:/usr/openwin/bin:/usr/sbin
: : : : : : setenv LD_LIBRARY_PATH $ORACLE_HOME/lib
: : : : : : setenv ORACLE_SID p
: : : : : : setenv ORA_NLS33 $ORACLE_HOME/ocommon/nls/admin/data
: : : : : : setenv PD $ORACLE_HOME/OracleXSU
: : : : : : setenv CLASSPATHJ
$ORACLE_HOME/jdbc/lib/classes111.zip
: : : : : : setenv XMLSQL_DIR $PD/lib/oraclexmlsql.jar:$PD
: : : : : : setenv ORACLE_PARSER $PD/lib/xmlparser.jar
: : : : : : setenv JDK_HOME /usr/java1.1
: : : : : : set CLASSPATH = ($ORACLE_PARSER $CLASSPATHJ $JDK_HOME
: : : : : : $XMLSQL_DIR)
: : : : : : setenv TNS_ADMIN $ORACLE_HOME/network/admin
: : : : : : setenv ORACLE_TERM sun5
: : : : : : echo 'Running .cshrc...'
: : : : : : alias ls ls -F
: : : : : Oracle Technology Network
: : : : : http://technet.oracle.com
: : : Oracle Technology Network
: : : http://technet.oracle.com
: Oracle Technology Network
: http://technet.oracle.com
null -
Unable to load Oracle XML SQL utility
The following error appears for each java
class, when we attempt to load Oracle XML sql
utility into Oracle using the oraclexmlsqlload
script:
E.g.
Error while resolving class OracleXMLStore
ORA-00904: invalid column name
Does anyone know why we would receive this error?
Platform: Hp-UX 11.0
Oracle Version: 8.1.5.0
Background information:
The database was original created with the
compatible=8.0.5 set in the init.ora file, and
the creatation of java classes failed due to this,
so switched compatible to 8.1.0. Now after we
we adjusted the compatible setting and restarted
database, we started to receive the errors as
described above.
nullMurali,
Thank you, after I initialized Oracle's javavm
the errors disappeared.
The scripts were located under the javavm/install
directory.
Thanks again.
Murali K (guest) wrote:
: Hi Steven,
: Is the JavaVM loaded. i.e. are all the classes necessary for
: running Java in the server are loaded into the server? The
most
: common answer to your problem is that the javavm has not been
: initialized correctly or the database does not have all the
java
: library files necessary to load java programs.
: Please read chapter 4 in the Oracle8i java developers guide
: which talks about initializing a java-enabled database by
: running the initjvm script.
: If this still occurs then maybe it is a bug and we will have
to
: look at it.
: Thx
: Murali
: Steven Wegner (guest) wrote:
: : The following error appears for each java
: : class, when we attempt to load Oracle XML sql
: : utility into Oracle using the oraclexmlsqlload
: : script:
: : E.g.
: : Error while resolving class OracleXMLStore
: : ORA-00904: invalid column name
: : Does anyone know why we would receive this error?
: : Platform: Hp-UX 11.0
: : Oracle Version: 8.1.5.0
: : Background information:
: : The database was original created with the
: : compatible=8.0.5 set in the init.ora file, and
: : the creatation of java classes failed due to this,
: : so switched compatible to 8.1.0. Now after we
: : we adjusted the compatible setting and restarted
: : database, we started to receive the errors as
: : described above.
null -
One reason why commandLink doesn't work in dataTable
Ok, so I think I've got an explanation why commandLink doesn't work in dataTable when the model bean is request scoped. Maybe somebody can tell me if I'm wrong.
I have a model bean that generates table rows based on some input criteria (request parameters).
So, we validate the inputs, apply them to the bean and render the page. Once the inputs have been applied to the bean, a request for table rows returns rows, no problem.
However, we put a commandLink in each row, so we can expand the details. Maybe we even get smart and repeat the input row-generating criteria as a hidden field in the page.
Unfortunately, when the user hits the commandLink, the list page simply refreshes, maybe even w/out table rows. The user doesn't get the details page as expected.
Why not?
Because: in the DECODE phase (even before validation and before "immediate" values have had their valueChangeListeners called), we ask the model bean for the table rows, so we can decode the commandLinks. Unfortunately, in "decode" phase, the request-scoped model bean has not had its row-generating criteria updated (that happens in the "update model" normally, or at the END of the decode phase if we got cute by (1) setting the "immediate" attribute on the row-generating criteria to "true" AND (2) set a valueChangeListener to allow us to update the model bean early. The END of the decode phase isn't good enough -- in the middle of that phase, when we're attempting to deocde commandLinks, the model bean has no citeria, so there's no row data. No row data means no iteration over commandLinks to decode them and queue ActionEvents. So, we march through the rest of the phases, process no events, and return to the screen of origin (the list screen) with no errors.
So, what's the solution?
One solution is to make the model bean session-scoped. Fine, maybe we can store a tiny bit of data in it (the search criteria), so it's not such a memory drag to have it live in the session forever. How do we get that data in? A managed property in faces-config.xml with value #{param.PARENT_KEY} won't work because it's assigning request-scoped data to a session-scoped holder. JBoss balks, and rightly so. Do we write code in the model bean that pulls the request parameter out of thin air? (FacesContext.getExternalContext()....) I don't really like to code the name of a specific http request parameter into the bean, I think it's the job of the JSP or faces-config.xml to achieve that binding (request parameter to model propery). Plus, I'd be sad to introduce a dependency on Faces in what was previously just a bean.
Is there a better way?
In my particular situation, we're grafting some Faces pages onto an already-existing non-Faces application. I don't get the luxury of presenting the user an input field and binding it to a bean. All I've got to work with is a request parameter.
Hmm, I guess I just answered my own question. if all I've got to work with is a request parameter, some ugliness is inevitable, I guess.
I guess the best fix is to cheat and have the bean constructor look for a request parameter. If it finds it, it initializes the criteria field (which, in my case, is the key of an object that has a bunch of associated objects (the rows data), but could be more-general d/b search criteria).
(I looked at the "repeater" example code in the RI, but it basically statically-generates its data and then uses 100% Faces (of course) to manage the paging (where "page number" is essentially the "criteria").
Comments? Did I miss something obvious?
John....or I could just break down and do the thing I was hoping to avoid (outputLink instead of commandLink):
<h:outputLink value="/faces/Detail.jsp">
<f:param name="PARENT_KEY" value="#{bean.parentKey}"/>
<h:outputText value="#{bean.label}"/>
</h:outputLink>It's still a "hardcoded" parameter name, but at least the binding is in the JSP and faces-config.xml, not the bean Java code. -
Updating a database using XML SQL Utility
Hi all,
It seems that the Oracle XML SQL Utility provides only to insert rows into a table/view. However, if one wants to update a table from an XML no support is available.
How does one proceed if this is to be achieved?
Thanks in advance.
Regards,
Manoj
nullWhile inserting i get a
oracle.xml.sql.OracleXMLSQLException and further a
NumberFormatException. Which parameter do I have to set to avoid
these Exceptions. I can insert the file in my local db but I get
the Exception on the server db. The value I want to insert for
expample is 30,1. Maybe the JDBC-Driver tries to convert the String ;30,1+ to an
Integer-Object. This will cause the described Exception since
the Integer-Class requires ;.+ instead of ;,+ for decimal point.
I have another problem generating an xmlfile when there
are "Umlaute" in the data. E.g. V and \. Exchanging these to Oe
and Ue than it works fine.Use ISO-8859-1 character set to work with umlauts, e.g.:
<?xml version = '1.0' encoding = 'ISO-8859-1'?>
.. but you can use the default UTF-8 encoding too, umlauts will
be replaced by equivalents as ;CŸ+
Alex -
Re: usage of XML SQL Utility
Hi there,
I have such a design issue, which I posted a few days ago and I reworded here. Hopefully, I made it clearer this time.
The working scenario, coded in Java, goes like this:
1> Given an XML string, I parse it out and get a set of values for a certain set of elements, say in one ROW.
2> I embed this set of values in the WHERE clause of a query string, do a SELECT.
3> Based on the result from the above SELECT, I do UPDATE, SELECT and INSERT to a few tables.
My question:
Could Oracle XML SQL Utility be used here? If yes, how?
From my reading so far, the Oracle XSU handles the SQL-XML and XML-SQL Mapping very well, in terms of a whole XML string. But, if at some point, I want to break the XML string and get some business logic mingled in it, say a simple calculation, how can I efficiently deal with it?
Any suggestion would be greatly appreciated. Thanks.
---Denali
nullHere are the five choices I see:
[list]
[*] XSU111_ver1_2_1.zip -- to be used with JDBC1.x (JDK1.1.x or later) and loadable into Oracle8.1.5 (486 KB)
[*] XSU12_ver1_2_1.zip -- to be used with JDBC2.0 (JDK1.2.x or later) and loadable into Oracle8.1.6 or later (508 KB)
[*] XSU111_816_ver2_1_0_beta.zip -- to be used with JDBC1.0 and JDK1.1.8 (486 KB)
[*] XSU12_816_ver2_1_0_beta.zip -- to be used with JDBC2.0 (JDK1.2.x or later) and loadable into Oracle8.1.6 (486 KB)
[*] XSU12_ver2_1_0_beta.zip -- to be used with JDBC2.0 (JDK1.2.x or later) and loadable into Oracle8.1.7 or later (508 KB)
[list] -
Hi, Oracle:
Are there upper limit with regard to OracleXMLSave.insertXML(),
such as upper limit for field size, upper limit for file size,
uppper limit for number of columns you can have, upper limit for
number of rows(records) you could have?
Prompt response will be greatly appreciated!
Thanks,
Tony
nullFirst, let me thank you for the reply.
Here is the situation: I want to insert a xml file about 3 MB
into an Oracle 8.0.5 table, in the table, I have a field called
resume which is of type LONG. I am using OracleXMLSave.insertXML
to do the insertion and oci8 jdbc connection. Here the error
messsage I got:
SIGSEGV 11* segmentation violation
si_signo [11]: SIGSEGV 11* segmentation violation
si_errno [0]:
si_code [1]: SEGV_MAPERR [addr: 0x342c9fe8]
stackbase=EFFFF298, stackpointer=EFFFD5D4
Full thread dump:
"SIGQUIT handler" (TID:0xed6662a0, sys_thread_t:0xfb400,
state:R, thread_t: t@5, sp:0xef373a90 threadID:0xef373de0,
stack_base:0xef373d74, stack_size:0x22000) prio=0
"Finalizer thread" (TID:0xed666088, sys_thread_t:0xfb370,
state:CW, thread_t: t@4, sp:0xef473a30 threadID:0xef473de0,
stack_base:0xef473d74, stack_size:0x22000) prio=1
"main" (TID:0xed6660b0, sys_thread_t:0xedff8, state:R,
thread_t: t@1, sp:0xefffedd8 threadID:0x20a18,
stack_base:0xeffff298, stack_size:0x800000) prio=5 *current
thread*
oracle.jdbc.oci8.OCIDBAccess.executeFetch(Compiled Code)
oracle.jdbc.driver.OracleStatement.doExecuteOther
(Compiled Code)
oracle.jdbc.driver.OracleStatement.doExecuteWithBatch
(Compiled Code)
oracle.jdbc.driver.OracleStatement.doExecute(Compiled
Code)
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout
(Compiled Code)
oracle.jdbc.driver.OraclePreparedStatement.executeUpdate
(Compiled Code)
oracle.jdbc.driver.OraclePreparedStatement.execute
(Compiled Code)
oracle.xml.sql.dml.OracleXMLSave.insertNodeVal(Compiled
Code)
oracle.xml.sql.dml.OracleXMLSave.insertXML(Compiled Code)
oracle.xml.sql.dml.OracleXMLSave.insertXML(Compiled Code)
TestSave.main(Compiled Code)
Monitor Cache Dump:
oracle.jdbc.oci8.OCIDBAccess@ED66A7E8/ED751B68: owner "main"
(0xedff8, 1 entry)
oracle.jdbc.driver.OracleCallableStatement@ED6D0390/EDF17818:
owner "main" (0xedff8, 2 entries)
Registered Monitor Dump:
PCMap lock: <unowned>
Thread queue lock: <unowned>
Name and type hash table lock: <unowned>
String intern lock: <unowned>
JNI pinning lock: <unowned>
JNI global reference lock: <unowned>
BinClass lock: <unowned>
Class loading lock: <unowned>
Java stack lock: <unowned>
Code rewrite lock: <unowned>
Heap lock: <unowned>
Has finalization queue lock: <unowned>
Finalize me queue lock: <unowned>
Waiting to be notified:
"Finalizer thread" (0xfb370)
Monitor registry: owner "main" (0xedff8, 1 entry)
Abort
======= End of error message ========
If I have a smaller size file, such as 1MB, it works. What could
be wrong? Oracle JDBC driver? the implementation of
OracleXMLSave.insertXML?
Here is the source code of my java program:
import oracle.xml.sql.dml.*;
import java.io.*;
import java.sql.*;
import oracle.jdbc.driver.*;
public class TestSave {
public static void main(String args[])
if (args.length != 2) {
System.out.println("Usage: java TestSave tablename
filename");
System.exit(1);
Connection conn;
String tablename = args[0];
String filename = args[1];
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection("jdbc:oracle:oci8:@econ",
"rich", "roy33");
OracleXMLSave xmlSave = new OracleXMLSave(conn, tablename);
System.out.println("xmlSave = " + xmlSave);
int num_row ;
java.net.URL url=xmlSave.createURL(filename);
System.out.println("url="+url);
num_row=xmlSave.insertXML(url);
System.out.println("num_row: " + num_row);
catch(Exception e)
e.printStackTrace();
}// end main
}// end TestSave
======= End of source code ====================
Any suggestions? Please help!!!
Tony
Oracle XML Team wrote:
: Hi Tony,
: I tried out an example with > 4000 binds and it seemed to
work
: with 3 clobs. How big is the sample? Can u attach a small
sample
: (dont have to have the big file. just the structure of the
XML?).
: Also currently the XML SQL utility simply binds CLOB columns
as
: strings. We will fix that so that it creates temp CLOBs and
: binds them. In that way you will not get into this problem.
: Thx
: Oracle XML team
: Tony (guest) wrote:
: : All right, I got a problem already. I have a table has 2
clob
: : columns, this is the message I got:
: : oracle.xml.sql.OracleXMLSQLException: java.sql.SQLException:
: ORA-
: : 01026: multiple buffers of size > 4000 in the bind list
: : at java.lang.Throwable.<init>(Compiled Code)
: : at java.lang.Exception.<init>(Compiled Code)
: : at java.lang.RuntimeException.<init>(Compiled Code)
: : at oracle.xml.sql.OracleXMLSQLException.<init>
: (Compiled
: : Code)
: : at oracle.xml.sql.dml.OracleXMLSave.insertXML
(Compiled
: : Code)
: : at oracle.xml.sql.dml.OracleXMLSave.insertXML
(Compiled
: : Code)
: : at TestSave.main(Compiled Code)
: : Does above mean that the utility can not handle a table has
: more
: : than one clob column?
: : In my applicaiton, I have two fields greater than 4000
: : characters that I need to insert into a table.
: : Thanks,
: : Tony
: : Tony (guest) wrote:
: : : I do not see any problems yet, however, I am going to have
: big
: : : field size (> 5000 characters), big file size(around 100
MB)
: : : which means lots of records. I just want to know whether
the
: : : utility can take it, if not, what are the options?
: : : Thanks,
: : : Tony
: : : Oracle XML Team wrote:
: : : : No designed-in limits. Are you hitting a problem
: : : : with a large-sized file?
: : : : Oracle XML Team
: : : : http://technet.oracle.com
: : : : Oracle Technology Network
: Oracle Technology Network
: http://technet.oracle.com
null -
Errors when loading XML SQL Utility
I'm working on a Unix machine, attempting
to load the Oracle XML SQL Utility classes
into my database so that I can use them in
stored procedures.
My problem is occuring when I try to use
loadjava to install the classes. I haved
altered both env.csh and oraclrxmlsqlload.csh to match my shell and desired settings, but I get a core dump when loadjava executes in the script:
SIGSEGV received. Processing terminated
full version ""
Full thread dump:
"Async Garbage Collector" (TID:0x3002bd00, sys_thread_t:0x2006b7d8)
Native Thread State: ThreadID: 00000203 Reuse: 1 DAEMON MONITOR WAIT
Native Stack Data : base: 201133a0 pointer 20113018 used(904) free(257144)
----- Monitors held -----
----- Native stack -----
------ Java stack ------ () prio=1
"Finalizer thread" (TID:0x3002bd38, sys_thread_t:0x2006b588)
Native Thread State: ThreadID: 00000102 Reuse: 1 DAEMON MONITOR WAIT
Native Stack Data : base: 200ca230 pointer 200c9f68 used(712) free(257336)
----- Monitors held -----
----- Native stack -----
------ Java stack ------ () prio=1
"main" (TID:0x3002bd70, sys_thread_t:0x20007278)
Native Thread State: ThreadID: 00000001 Reuse: 1 USER PRIMORDIAL RUNNING
Native Stack Data : base: 2ff22004 pointer 2ff1f658 used(10668) free(247380)
----- Monitors held -----
java.lang.Class java/sql/DriverManager@30025318
oracle.jdbc.oci8.OCIDBAccess@300304e8
----- Native stack -----
eoj_memcpy(d15779b8)
eoj_memcpy(d1574d08)
eoj_memcpy(d1574484)
inflate_copyright(2c203a6e)
inflate_copyright(2c203a6e)
[sigsegv]...
------ Java stack ------ () prio=5 current thread
Anyone have any ideas what might be the problem?Sorry...missed your first question there.
I'm running AIX 4.3.2 on an IBM RS/6000 Server. I've got Java 1.1.6 installed. -
XML SQL Utility - declaration error
Hi,
I'm trying to use the XSU API in a Java server page and am getting an error with the <?xml version='1.0'> declaration tag. The parser seems to think it is not well-formed. Here is what I am doing: Using JSP, I query my database and use XSU to return the results as an XML string. I'm working on an Oracle personal edition version 8.1.7 on an Windows 2000 machine. When I had the Microsoft XML Parser version 2.5 installed, XSU would work and it would print out the XML document tree view. The document was well-formed, according to IE5.5. However, I wanted to use an XSLT stylesheet that would print out the xml results in an HTML table. The MS XML Parser 2.5 had to be upgraded to version 3.0 in replace mode, in order for the XSLT stylesheets to work. When I upgraded, the stylesheets worked, but then for all the JSP pages that were utilizing the XML SQL Utility, when I tried to view the page in IE5.5, I would get the declaration tag error I mentioned above.
Any suggestions on how I can get the JSPs to work with XSU (without having to revert back to the older MS parser)? Is there another parser that I can use? I'm working with the Apache web server that Oracle personal edition installs.
Thanks,
SYThe XML Declaration needs to be:
<?xml version="1.0"?>
and it must be the very first bytes of the file. There must not be any whitespace before the <?xml version="1.0"?> in what the JSP returns to the browser.
This extra whitespace is frequently the cause of the problem in JSP cases that I've seen. -
SOAP oracle xml sql utility class definition not found error
I have created a java class that connects to database using JDBC runs an sql statement and produces xml using Oracle XML SQL Utility class. The java class works perfectly when I deploy it as a soap web service and try to run through SOAP server it gives a SOAP error oracle/xml/sql/query/OracleXML/Query [java.lang.NoClassDefFoundError].
Can anyone help please.
Thanks
AlinaSounds like you have not included the xsu12.jar file in the server-side CLASSPATH.
This depends also on the xmlparserv2.jar and on the Oracle JDBC driver. Later versions
of XSU may also depend on the xdb.jar file, too. -
I am using Oracle XML SQL utility to generate some XML using CURSOR
operator.
Following is the query -
SELECT PROJECT.PROJ_CD,
PROJECT.PROJ_TITLE,
CURSOR(SELECT ISSUES.ISSUE_ID
FROM ISSUES
WHERE PROJECT.PROJ_ID = ISSUES.PROJ_ID )
as ISSUES_DATA
FROM PROJECT
WHERE PROJECT.PROJ_ID = 1
This query works fine when I create a direct connection using Oracle JDBC
thin driver. But when I execute same thing using a connection from a
Weblogic connection pool (which uses exactly the same Oracle JDBC thin
driver, classes12.zip), I get following error-
<?xml version = '1.0'?>
<ERROR>oracle.xml.sql.OracleXMLSQLException: cursorGetMetaData: this method
is not supported by OracleXMLDataSetGenJdbc' class. Please use
'OracleXMLDataSetExtJdbc' instead.</ERROR>
Following are the details about my environment:
Weblogic5.1 on Windows NT 4.0
Oracle 8.1.5 on Sun Solaris
Oracle JDBC thin Classes12.zip (from Oracle 8.1.6)
Oracle XML SQL utility XSU12_ver1_2_1
Does anyone have any idea what is going on. Please help.
Thanks.Thanks for your reply.
Here is what I am doing:
I have connection pool defined in welogic.properties file
weblogic.jdbc.connectionPool.oraclePool=\
url=jdbc:oracle:thin:@192.168.2.251:1521:orcl,\
driver=oracle.jdbc.driver.OracleDriver,\
loginDelaySecs=1,\
initialCapacity=1,\
maxCapacity=15,\
capacityIncrement=1,\
allowShrinking=true,\
shrinkPeriodMins=5,\
refreshMinutes=5,\
testTable=,\
props=user=someuser;password=somepasswd
weblogic.allow.reserve.weblogic.jdbc.connectionPool.oraclePool=everyone
weblogic.jdbc.TXDataSource.orclDataSource=oraclePool
Then I have a DBConnection class which gets connection from the pool
following is some code from DBConnection class
private Connection con = null;
private DataSource ds = null;
private String providerURL;
private String dataSource;
private String contextFactory;
private IpmsProps ipmsProp = null;
public Connection getConnection() {
if ( con == null ) {
try {
ipmsProp = IpmsProps.getInstance();
providerURL = ipmsProp.getProviderURL();
dataSource = ipmsProp.getDataSource();
contextFactory = ipmsProp.getContextFactory();
Properties p = new Properties();
p.put(javax.naming.Context.PROVIDER_URL, providerURL);
p.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,
contextFactory);
Context ctx = new InitialContext(p);
Context ctx = new InitialContext();
ds = (DataSource) ctx.lookup(dataSource);
con = ds.getConnection();
} catch (Exception e) {
System.out.println("Error While creating connection! " +
e.toString());
} // catch
I Hope you will be able to provide me some work around.
Thank you very much for the help.
Rajinder.
"Joseph Weinstein" <[email protected]> wrote in message
news:[email protected]...
Hi. It's probably because you're calling some Oracle-specific method,passing it
a pool JDBC object, and though the Oracle methos signature says it will
take a generic java.sql.XXX object, it really is going to assume the thingis
an Oracle class, and fails when it tries to cast it to such.
Depending on how you're getting your pool connection, I may have aworkaround.
Joe
Rajinder Arora wrote:
I am using Oracle XML SQL utility to generate some XML using CURSOR
operator.
Following is the query -
SELECT PROJECT.PROJ_CD,
PROJECT.PROJ_TITLE,
CURSOR(SELECT ISSUES.ISSUE_ID
FROM ISSUES
WHERE PROJECT.PROJ_ID =
ISSUES.PROJ_ID )
as ISSUES_DATA
FROM PROJECT
WHERE PROJECT.PROJ_ID = 1
This query works fine when I create a direct connection using OracleJDBC
thin driver. But when I execute same thing using a connection from a
Weblogic connection pool (which uses exactly the same Oracle JDBC thin
driver, classes12.zip), I get following error-
<?xml version = '1.0'?>
<ERROR>oracle.xml.sql.OracleXMLSQLException: cursorGetMetaData: thismethod
is not supported by OracleXMLDataSetGenJdbc' class. Please use
'OracleXMLDataSetExtJdbc' instead.</ERROR>
Following are the details about my environment:
Weblogic5.1 on Windows NT 4.0
Oracle 8.1.5 on Sun Solaris
Oracle JDBC thin Classes12.zip (from Oracle 8.1.6)
Oracle XML SQL utility XSU12_ver1_2_1
Does anyone have any idea what is going on. Please help.
Thanks.--
PS: Folks: BEA WebLogic is expanding rapidly, with both entry and advancedpositions
for people who want to work with Java, XML, SOAP and E-Commerceinfrastructure products.
We have jobs at Nashua NH, Liberty Corner NJ, San Francisco and San JoseCA.
Send resumes to [email protected] -
XML SQL Utility, 8i, NT4, test code
I have been unable to get the sample code to run successfully
after installing the XML SQL Utility on Oracle 8.1.5.0.0 on
Windows NT4 Service Pack 4.
To make sure I was doing nothing wrong, I reinstalled Oracle 8i
and loaded all the java into scott/tiger. Also the PLXMLPARSER
codes does appear to run correctly. At least the samples seem to
work.
I tried to use the oraclexmlsqlload.bat script, but the script
stopped after after loading oraclexmlsql.jar. So I ran each of
the loadjava scripts on the command line. They exited without
errors. Even the xmlgen package installed without errors. But
when I ran oraclexmlsqltest.sql, I got a message that said the
procedure completed successfully, but there was not output.
I put a dbms_output.put_line(SQLCODE) with each of the two
exceptions and got the following error. The procedure actually
failed on "when others" with error -29531. According to the
Error Manual this is
ORA-29531 no method string in class string
Cause: An attempt was made to execute a non-existent method in a
Java class.
Action: Adjust the call or create the specified method.
At this point I am not sure what to do.
nullHi Frank,
Frank, make sure that the two "select xmlgen....." are
returning a valid XML document. If these aren't working let me
know, otherwise add a:
set serveroutput on
after the commit.
Also, before you do this, restore oraclexmlsqltest.sql to its
original state ... the exception section was masking exceptions
which we are aware we generate. If you look closely you will see
that we do a very rough job outputing the lob containing the XML
document (we print out past the length of the LOB, which raises
an exception).
Let me know what happens.
Frank Hubeny (guest) wrote:
: I have been unable to get the sample code to run successfully
: after installing the XML SQL Utility on Oracle 8.1.5.0.0 on
: Windows NT4 Service Pack 4.
: To make sure I was doing nothing wrong, I reinstalled Oracle 8i
: and loaded all the java into scott/tiger. Also the PLXMLPARSER
: codes does appear to run correctly. At least the samples seem
to
: work.
: I tried to use the oraclexmlsqlload.bat script, but the script
: stopped after after loading oraclexmlsql.jar. So I ran each of
: the loadjava scripts on the command line. They exited without
: errors. Even the xmlgen package installed without errors. But
: when I ran oraclexmlsqltest.sql, I got a message that said the
: procedure completed successfully, but there was not output.
: I put a dbms_output.put_line(SQLCODE) with each of the two
: exceptions and got the following error. The procedure actually
: failed on "when others" with error -29531. According to the
: Error Manual this is
: ORA-29531 no method string in class string
: Cause: An attempt was made to execute a non-existent method in
a
: Java class.
: Action: Adjust the call or create the specified method.
: At this point I am not sure what to do.
Oracle Technology Network
http://technet.oracle.com
null -
Hi,
I am trying to retrieve data from a DB table and generate an XML file. I am using Oracle8i and IIS 4.0.
I have downloaded XML SQL utility and I followed the installation instructions. I executed oraclexmlsqlload.bat file. It got executed and then I got the following error
ORA-12203: TNS:unable to connect to destination.
Let me know whether I should have JDK1.1x and JDBC 1.x compliant drivers installed in my machine. can any one help me ??
vikUse xmlgen.setDateFormat('yyyy-MM-dd hh:mm:ss') and try it out
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Mark Hansen:
I am having trouble with the xmlgen package within the XML SQL utility software version 1.1.1. I wrote a package that gets an XML file and loads it into a temporary CLOB and then using xmlgen.insertXML it inserts the XML into table. Everything works fine except for a date column in the table. I get an error when it tries to parse the date. Using the procedure xmlgen.setDateFormat, I tried to set the default date format, but I still get an error. Below you will find the text of the error message that I am getting:
ORA-29532: Java call terminated by uncaught Java exception:
oracle.xml.sql.OracleXMLSQLException: Exception
'java.text.ParseException:Unparseable date: "2000-08-24 08:34:24"' encountered
during processing ROW element 0All prior XML row changes were rolled back. in
the XML document.
ORA-06512: at "SITESTEPPER.SS_LOG", line 30
ORA-06512: at line 1
I've tried a number of diferent date formats including the database default date format. I have a work around to this but it involves the use of a temporary table. Please Help!
<HR></BLOCKQUOTE>
null
Maybe you are looking for
-
Music no longer syncs to iPad/iPhone
Hi, As the title suggests, music will no longer sync to any of my mobile devices (iPad Mini, Summer 2013, current iOS 7; iPhone 4S, Feb 2012, current iOS 7). I've reset the factory settings, and restored a back-up and allowed the content to re-sync.
-
Thumbnails of images don't display in Blog Summary
I'd be grateful if someone could help me with this problem. I am new to working with iWeb and have a site hosted on MobileMe. The address is: thismomentexactly.com. On the Blog Summary page, the images do not appear despite the fact that I have ticke
-
Using JSF in search engine.
Hi, I am implementing a search engine. I want to use jsf for for the UI part. I have few queries in this regard. - Has anybody used jsf for the same? - Since the search result may contain any number of result, then it is not good to first load all th
-
Mouse pointer/hardware annoying
I'm not sure if anyone else is having this problem or it's just me. Basically I get really annoyed with the mouse pointer (trackball or regular mouse) option where it detects the speed you move the mouse and works accordingly. In other words, I might
-
HT203167 purchased app doesn't show up in my purchases
although i have the app on my computer and my ipad. itunes says that i haven't puchased it and therefore won't allow me to upgrade. (if i locate it in the store it asks me to buy it). I have the reciept. whats going on?