HOWTO: Writing Out XML Query Results of Any Size in Java with XML SQL Utility
A customer mailed me asking for an example of how to use our XML SQL Utility to write out query results for tons of query result rows.
With tons of data, the getXMLDOM() and getXMLString() methods are not really appropriate due to the size.
The XML SQL Utility offers a getXMLSAX() method that streams SAX2 events to report the data being queried. This is the approach we can use to handle data of any size.
It dawned on me today that by putting together the XML SQL Utilities getXMLSAX() routine, and the oracle.xml.parser.v2.XSLSAXPrintDriver SAX2 ContentHandler, we can effectively stream out data of any length to an appropriate writer.
Here's a code example to get the point across:
package test;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Properties;
import javax.xml.transform.OutputKeys;
import oracle.jdbc.OracleDriver;
import oracle.xml.parser.v2.XSLException;
import oracle.xml.parser.v2.XSLOutput;
import oracle.xml.parser.v2.XSLSAXPrintDriver;
import oracle.xml.sql.query.OracleXMLQuery;
public class Example {
private static final String QUERY = "select * from emp";
public static void main(String[] args) throws Throwable {
Connection conn = getConnection();
OracleXMLQuery q = new OracleXMLQuery(getConnection(),QUERY);
// Any printwriter will do. Here's we're output to standard out.
PrintWriter output = new PrintWriter(new BufferedOutputStream(System.out));
// This is a SAX2 Content Handler used by the Oracle XSLT Engine
// to serialize a stream of sax2 events as an XML document
// We'll use it to serialize the sax2 events from the XML SQL Utility
// out as an XML document.
XSLSAXPrintDriver ch = new XSLSAXPrintDriver(output, outputOptions());
// This asks XML SQL Utility to fire sax events for the data
// being fetched instead of creating DOM nodes or returning text.
// By using the XSLSAXPrintDriver content handler, these events
// get handled by writing them directly to the output stream
q.getXMLSAX(ch);
ch.flush();
q.close();
conn.close();
private static XSLOutput outputOptions() throws XSLException {
XSLOutput x = new XSLOutput();
Properties props = new Properties();
props.put(OutputKeys.METHOD,"xml");
props.put(OutputKeys.INDENT,"yes"); // Set to "no" for non-indented
x.setProps(props);
return x;
public static Connection getConnection() throws SQLException {
String username = "scott";
String password = "tiger";
String thinConn = "jdbc:oracle:thin:@localhost:1521:ORCL";
Driver d = new OracleDriver();
return DriverManager.getConnection(thinConn,username,password);
}
Hi Uber,
This is a known issue that error occurs when running report "Count of instances of specific software registered with Add or Remove Programs" due to non-printable characters for XML. Based on internal research, the hotfix for this issue will be
included in the System Center 2012 Configuration Manager Service Pack 1.
As a workaround, you can remove the nonprintable character populated into the report parameter by referring to the following KB article:
http://support.microsoft.com/KB/914159
Hope this helps.
Regards,
Mike Yin
Mike Yin
TechNet Community Support
Similar Messages
-
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);
nullFirstly 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 -
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] -
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. -
Hi,
I'm trying to use the XML SQL Utility against a 8.0.5 database.
I coded a basic query against the SCOTT.EMP table.
I've instantiated an OracleXMLQuery object using both types of
constructors (i.e. Connection + ResultSet or query String). In
both cases the resulting XML String contains:
<?xml version="1.0"?>
<ERROR>Closed Resultset</ERROR>
I know that my Connection and ResultSet objects are valid because
I examined the ResultSet contents using standard JDBC getXXX
methods for the same Connection and query. I am establishing my
Connection using the thin driver. Is this the problem? Can you
also elaborate on the Oracle specific requirements for this API?
For example, will the API work for Connection and ResultSet
objects against non-Oracle databases? Thanks.
Fred
nullHi Fred,
The closed ResultSet problem would occur when u are trying to
re-use the same object,
e.g.
OracleXMLQuery oxq = new OracleXMLQuery(conn,resultsetobject);
// get the string..
String xmlString = oxq.getXMLString();
By default OracleXMLQuery closes the ResultSet after
completion. so if u use.
xmlString = oxq.getXMLString();
again, you will get this error.
To overcome this there is a call called keepCursorAlive() which
takes in a boolean value. So call that function on oxq before
getting the first string and everything will be all right.
Currently we also close the resultSet given by the user. This
is a bug (we should only close our internal resultset) and we
will fix it in the next drop. Also we will make this error
message much more legible!
Regarding working against other databases, we use Oracle
specific stuff currently in case of object features such as
ADTs, REFs and collections and LOBs. For regular relational data
such as number, varchar etc.., we don't do anything special.
So for plain relational data this should work against
ResultSet and Connection objects created from other databases.
But to be honest, we haven't tested that out. So if you do
indeed run into any problems with other databases, please let us
know and we will try to fix it.
Thx
Murali
Fred Criscuolo (guest) wrote:
: Hi,
: I'm trying to use the XML SQL Utility against a 8.0.5 database.
: I coded a basic query against the SCOTT.EMP table.
: I've instantiated an OracleXMLQuery object using both types of
: constructors (i.e. Connection + ResultSet or query String).
In
: both cases the resulting XML String contains:
: <?xml version="1.0"?>
: <ERROR>Closed Resultset</ERROR>
: I know that my Connection and ResultSet objects are valid
because
: I examined the ResultSet contents using standard JDBC getXXX
: methods for the same Connection and query. I am establishing
my
: Connection using the thin driver. Is this the problem? Can
you
: also elaborate on the Oracle specific requirements for this
API?
: For example, will the API work for Connection and ResultSet
: objects against non-Oracle databases? Thanks.
: Fred
null -
Hi,
When I try to execute this query using XML SQL utility
I am getting the following error. I had declared 'XMLGEN &
GETXML' as CLOB and tried but got the same error. Advice me. I
am struggling to find the solution using XSQL Servlet..but
couldn't get..I spend one week on that..no results...this is the
second trial. Is there any online help or service to do that.
xmlString := xmlgen.getXML('select * from scott.emp');
ERROR at line 9:
ORA-06550: line 9, column 16:
PLS-00201: identifier 'XMLGEN.GETXML' must be declared
ORA-06550: line 9, column 3:
PL/SQL: Statement ignored
I have Oracle XML parser for Java 2, and XML SQL utility and
oracle 8i database....
This is the query.........(Your example)
declare
xmlString CLOB;
amount integer:= 4000;
position integer := 1;
charString varchar2(4000);
i binary_integer := 0;
inclDTD number := 0;
begin
xmlString := xmlgen.getXML('select * from scott.emp');
dbms_lob.open(xmlString,DBMS_LOB.LOB_READONLY);
loop
dbms_lob.read(xmlString,amount,position,charString);
dbms_output.put_line(charString);
position := position + amount;
end loop;
exception
when no_data_found then
dbms_lob.close(xmlString);
dbms_lob.freetemporary(xmlString);
end;
nullHave you loaded the xmlgenpkg.sql in the schema in which you
are trying to execute your PL/SQL block?
Chan (guest) wrote:
: Hi,
: When I try to execute this query using XML SQL utility
: I am getting the following error. I had declared 'XMLGEN &
: GETXML' as CLOB and tried but got the same error. Advice me. I
: am struggling to find the solution using XSQL Servlet..but
: couldn't get..I spend one week on that..no results...this is
the
: second trial. Is there any online help or service to do that.
: xmlString := xmlgen.getXML('select * from scott.emp');
: ERROR at line 9:
: ORA-06550: line 9, column 16:
: PLS-00201: identifier 'XMLGEN.GETXML' must be declared
: ORA-06550: line 9, column 3:
: PL/SQL: Statement ignored
: I have Oracle XML parser for Java 2, and XML SQL utility and
: oracle 8i database....
: This is the query.........(Your example)
: declare
: xmlString CLOB;
: amount integer:= 4000;
: position integer := 1;
: charString varchar2(4000);
: i binary_integer := 0;
: inclDTD number := 0;
: begin
: xmlString := xmlgen.getXML('select * from scott.emp');
: dbms_lob.open(xmlString,DBMS_LOB.LOB_READONLY);
: loop
: dbms_lob.read(xmlString,amount,position,charString);
: dbms_output.put_line(charString);
: position := position + amount;
: end loop;
: exception
: when no_data_found then
: dbms_lob.close(xmlString);
: dbms_lob.freetemporary(xmlString);
: end;
Oracle Technology Network
http://technet.oracle.com
null -
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 and stored procedure
Hi there,
Is it possible to use the XML/SQL Utility passing a stored
procedure call, which returns a result set (ref cursor), instead
of a SELECT statement? If yes, how should I call the
OracleXMLQuery constructor?
Thanks,
Flavio.
nullHere's a sample. The next code drop of the XSQL Servlet will make the easy-to-do from within XSQL Pages:
package package1;
import org.w3c.dom.*;
import java.sql.*;
import oracle.jdbc.driver.*;
import oracle.xml.sql.query.OracleXMLQuery;
public class Class1 extends Object {
public static void main( String[] arg ) throws Exception {
Connection conn = getConnection();
CallableStatement ocs = conn.prepareCall("begin ? := App.HotItems('PAUL'); end;");
ocs.registerOutParameter(1,OracleTypes.CURSOR);
ocs.execute();
ResultSet rs = ((OracleCallableStatement)ocs).getCursor(1);
OracleXMLQuery oxq = new OracleXMLQuery(conn,rs);
System.out.println(oxq.getXMLString());
oxq.close();
rs.close();
ocs.close();
conn.close();
public static Connection getConnection() throws Exception {
String username = "scott";
String password = "tiger";
String dburl = "jdbc:oracle:thin:@localhost:1521:xml";
String driverClass = "oracle.jdbc.driver.OracleDriver";
Driver d = (Driver)Class.forName(driverClass).newInstance();
return DriverManager.getConnection(dburl,username,password);
null -
XML SQL utility ( Urgent)
Hi,
I am trying to install XML SQL utility. I have jdk1.2.2 and
oracle xml parser v2. I ran the env.bat file. Then when I try to
run the oraclexmlsqlload.sql file i got 822 errors. Then I try
to run the first file "loadjava -resolve -verbose -user %
USER_PASSWORD% xmlparser.jar" I got some these kind of errors,
resolving: org/w3c/dom/html/HTMLBodyElement
Error while resolving class org/w3c/dom/html/HTMLBodyElement
ORA-04043: object org/w3c/dom/html/HTMLBodyElement does not
exist
resolving: org/xml/sax/helpers/LocatorImpl
Error while resolving class org/xml/sax/helpers/LocatorImpl
ORA-04043: object org/xml/sax/helpers/LocatorImpl does not
exist
resolving: oracle/xml/parser/v2/Axis
Error while resolving class oracle/xml/parser/v2/Axis
ORA-04043: object oracle/xml/parser/v2/Axis does not exist
resolving: oracle/xml/parser/v2/PathExpr
Error while resolving class oracle/xml/parser/v2/PathExpr
ORA-04043: object oracle/xml/parser/v2/PathExpr does not
exist
resolving: oracle/xml/parser/v2/FromDescPrecedingSibling
Error while resolving class
oracle/xml/parser/v2/FromDescPrecedingSibling
ORA-04043: object
oracle/xml/parser/v2/FromDescPrecedingSibling does not exi
st
"I GOT SOME VIEW/TABLE DOES NOT EXIST ERROR ALSO"
Here is my env.bat file..................
rem Copyright (c) Oracle Corporation 1999. All Rights Reserved.
rem
rem NAME
rem env
rem
rem DESCRIPTION
rem environmental variables needed to compile or run
OracleXML utility
rem
rem ------------------------ oraclexmlsql utility directory path
rem set PD to point to the directory in which you expanded the
zip file
set PD=C:\Oracletools\OracleXSU
rem ------------------------ JDBC classes
set CLASSPATHJ=D:\Oracle\Ora8i\jdbc\lib\classes111.zip
rem ------------------------
rem This need not be changed
set XMLSQL_DIR=%PD%\lib\oraclexmlsql.jar;%PD%;%PD%\src;%PD%\lib;%
PD%\sample
rem ------------------------ Oracle XML parser settings
rem This need not be changed
set ORACLE_PARSER=%PD%\lib\xmlparser.jar
rem ------------------------ JDK_HOME
set JDK_HOME=C:\JDK1.2.2
rem ------------------------ CLASSPATH settings
set CLASSPATH=%ORACLE_PARSER%;%CLASSPATHJ%;%JDK_HOME%
\lib\classes.zip;%XMLSQL_DIR%;%CLASSPATH%
I need urgent help from you...........
Thanks,
Chandran...
nullHi,
Here is the problem. As per your suggestion I had installed
Jdk1.8.8 and jdbc driver too. Though I am having one JDBC driver
in oracle8i, I have downloaded from your site and set the env
path and run the env.bat file. Then when I tried to execute the
Java OracleXML getXML -user "scott/tiger" "select * from emp"
file I got runtime error. But first time what I did was I had
already run the oraclexmlsqlload file so there are lot of
chances for OracleXML class file to be deleted. So Again I ran
the oraclexmlsqlload bat file, so definitely it should load the
oraclexmlsql file and xmlparser file. I didn't get any error. So
I tried the file for xmlgenpkg it says package created with no
errors and when I tried the oraclexmlsqltest file I got the same
error...what I did get yesterday............
Here is the output , please help me out....
SQL> @C:\Oracletools\OracleXSU\lib\oraclexmlsqltest.sql;
SQL> Rem
SQL> Rem $Header: oraclexmlsqltest.sql 27-jul-99.22:53:37
vnimani Exp $
SQL> Rem
SQL> Rem oraclexmlsqltest.sql
SQL> Rem
SQL> Rem Copyright (c) Oracle Corporation 1999. All Rights
Reserved.
SQL> Rem
SQL> Rem NAME
SQL> Rem oraclexmlsqltest.sql - <one-line expansion of
the name>
SQL> Rem
SQL> Rem DESCRIPTION
SQL> Rem <short description of component this file
declares/defines>
SQL> Rem
SQL> Rem NOTES
SQL> Rem <other useful comments, qualifications, etc.>
SQL> Rem
SQL> Rem MODIFIED (MM/DD/YY)
SQL> Rem vnimani 07/27/99 - add testing for
setStyleSheetType
SQL> Rem vnimani 06/19/99 -
Rem mkrishna 06/13/99 -
Rem mkrishna 06/13/99 - add more testsSQL> Rem mkrishna 05/27/99 - sql testing the db loaded util
SQL> Rem mkrishna 05/27/99 - Created
SQL> Rem
SQL>
SQL> Rem Do not set serveroutput to be on here. There are
problems (bug) when the
SQL> Rem serveroutput is turned on before the last PL/SQL block
is executed.
SQL>
SQL> set long 4000
SQL> set pages 8000
SQL> set echo on
SQL>
SQL> Rem Use these to test the results..
SQL> select xmlgen.getXML('select * from scott.emp',1) from dual;
select xmlgen.getXML('select * from scott.emp',1) from dual
ERROR at line 1:
ORA-29540: class OracleXMLStore does not exist
ORA-06512: at "SCOTT.XMLGEN", line 83
ORA-06512: at "SCOTT.XMLGEN", line 83
ORA-06512: at line 1
SQL> select xmlgen.getXML('select * from all_Tables where
owner=''SCOTT''') from dual;
select xmlgen.getXML('select * from all_Tables where
owner=''SCOTT''') from dual
ERROR at line 1:
ORA-29540: class OracleXMLStore does not exist
ORA-06512: at "SCOTT.XMLGEN", line 83
ORA-06512: at "SCOTT.XMLGEN", line 83
ORA-06512: at line 1
SQL>
SQL> Rem
SQL>
SQL>
SQL> commit;
Commit complete.
Thanks,
Chan...
Oracle XML Team wrote:
: Hi Chan,
: Soon we will release a version of the XSU which runs with
: JDK1.2 but for now the XSU requires JDK1.1.x. Also, your
: Oracle8i (or later) database must be java enabled.
: for starters, try and run the command line front end of the
: utility:
: java OracleXML getXML -user "scott/tiger" "select * from emp"
: once you get this part running then proceed trying to load
the
: utility into the db. Note, to run the command line front end
you
: will need to have the Oracle JDBC drivers for use with
JDK1.1.x.
: They are freely available from:
: technet.oracle.com/tech/java/sqlj_jdbc
: Chan (guest) wrote:
: : Hi,
: : I am trying to install XML SQL utility. I have jdk1.2.2
and
: : oracle xml parser v2. I ran the env.bat file. Then when I try
: to
: : run the oraclexmlsqlload.sql file i got 822 errors. Then I
try
: : to run the first file "loadjava -resolve -verbose -user %
: : USER_PASSWORD% xmlparser.jar" I got some these kind of
errors,
: : resolving: org/w3c/dom/html/HTMLBodyElement
: : Error while resolving class org/w3c/dom/html/HTMLBodyElement
: : ORA-04043: object org/w3c/dom/html/HTMLBodyElement does
not
: : exist
: : resolving: org/xml/sax/helpers/LocatorImpl
: : Error while resolving class org/xml/sax/helpers/LocatorImpl
: : ORA-04043: object org/xml/sax/helpers/LocatorImpl does
not
: : exist
: : resolving: oracle/xml/parser/v2/Axis
: : Error while resolving class oracle/xml/parser/v2/Axis
: : ORA-04043: object oracle/xml/parser/v2/Axis does not
exist
: : resolving: oracle/xml/parser/v2/PathExpr
: : Error while resolving class oracle/xml/parser/v2/PathExpr
: : ORA-04043: object oracle/xml/parser/v2/PathExpr does not
: : exist
: : resolving: oracle/xml/parser/v2/FromDescPrecedingSibling
: : Error while resolving class
: : oracle/xml/parser/v2/FromDescPrecedingSibling
: : ORA-04043: object
: : oracle/xml/parser/v2/FromDescPrecedingSibling does not exi
: : st
: : "I GOT SOME VIEW/TABLE DOES NOT EXIST ERROR ALSO"
: : Here is my env.bat file..................
: : rem Copyright (c) Oracle Corporation 1999. All Rights
: Reserved.
: : rem
: : rem NAME
: : rem env
: : rem
: : rem DESCRIPTION
: : rem environmental variables needed to compile or run
: : OracleXML utility
: : rem
: : rem ------------------------ oraclexmlsql utility directory
: path
: : rem set PD to point to the directory in which you expanded
the
: : zip file
: : set PD=C:\Oracletools\OracleXSU
: : rem ------------------------ JDBC classes
: : set CLASSPATHJ=D:\Oracle\Ora8i\jdbc\lib\classes111.zip
: : rem ------------------------
: : rem This need not be changed
: : set
: XMLSQL_DIR=%PD%\lib\oraclexmlsql.jar;%PD%;%PD%\src;%PD%\lib;%
: : PD%\sample
: : rem ------------------------ Oracle XML parser settings
: : rem This need not be changed
: : set ORACLE_PARSER=%PD%\lib\xmlparser.jar
: : rem ------------------------ JDK_HOME
: : set JDK_HOME=C:\JDK1.2.2
: : rem ------------------------ CLASSPATH settings
: : set CLASSPATH=%ORACLE_PARSER%;%CLASSPATHJ%;%JDK_HOME%
: : \lib\classes.zip;%XMLSQL_DIR%;%CLASSPATH%
: : I need urgent help from you...........
: : Thanks,
: : Chandran...
: Oracle Technology Network
: http://technet.oracle.com
null -
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 -
Is XML-SQL Utility for Java run on Client Side?
A question about the XML-SQL Utility for Java
When a client program connect to a Oracle database (the clinet program and Oracle DB is run on two different machine. Oracle 8i is used) and use the oracle.xml.sql.query.OracleXMLQuery Class (form the XSU) to generate XML by given a SQL query. I want to know the transforation process is execute in the Clinet side or the database?
Is there any method that i can retrieve the XML directly from the database rather then doing the transformation form the Client side?Set JDK_HOME to the directory where you install your JDK (Java Development Kit).
So instance, I've install JDK1.1.8 on my
C drive so
set JDK_HOME=c:\jdk1.1.8;c:\jdk1.1.8\bin -
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 -
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 -
Greetings:
I am working on how to use xml and 8i to our benefit. I have
installed Oracle 8i and I have downloaded the XML SQL Utility.
In checking out the installation using the standard "java ...
select from" example I get the following error:
Exception in thread "main" java.lang.NoClassDefFoundError:
OracleXML
The first place I checked was the env.bat file, I found an
incorrect classpath and changed it:
rem - JDK_HOME
set JDK_HOME=C:\JDK1.1.6 (no such folder)
to
rem - JDK_HOME
set JDK_HOME=C:\JDK1.2.2
All other paths look good. I executed the bat file and tried the
example again. Same error.
Any Ideas??
nullStill same error.
Here is what I've done.
1. rem the JDK Home
2. downloaded Java 1.1.8 JDK
3. changed computer env. path to include 1.1.8 JDK
I have checked all the paths in the bat file and all are pointing
to the correct place to find the file listed with one exception:
I don't have a src file in the %PD% folder.
rem This need not be changed
set
XMLSQL_DIR=%PD%\lib\oraclexmlsql.jar;%PD%;%PD%\src;%PD%\lib;%PD%\
sample
Where should it be pointing for the src file?
Oracle XML Team wrote:
: Hi Michael,
: Based on the symptoms described, I am guessing something in
: your environment still isn't right (i.e. env.bat hasn't been
: configured correctly). Please confirm that all the paths in
that
: directory point to the right places. In particular make
: sure that your CLASSPATH includes the directory in which
: oraclexmlsql.jar and parser.jar reside. Also, the XSU is
: supposed to run against JDK1.1.6 (we haven't tested it against
: 1.2). One last thing... make sure that JAVA_HOME environment
: variable is NOT set (i.e. make sure it is undefined).
: Michael Cline (guest) wrote:
: : Greetings:
: : I am working on how to use xml and 8i to our benefit. I have
: : installed Oracle 8i and I have downloaded the XML SQL
Utility.
: : In checking out the installation using the standard "java ...
: : select from" example I get the following error:
: : Exception in thread "main" java.lang.NoClassDefFoundError:
: : OracleXML
: : The first place I checked was the env.bat file, I found an
: : incorrect classpath and changed it:
: : rem - JDK_HOME
: : set JDK_HOME=C:\JDK1.1.6 (no such folder)
: : to
: : rem - JDK_HOME
: : set JDK_HOME=C:\JDK1.2.2
: : All other paths look good. I executed the bat file and tried
: the
: : example again. Same error.
: : Any Ideas??
: Oracle Technology Network
: http://technet.oracle.com
null -
1.2 JVM crashes using XML SQL Utility 1.1.10 (NT 8.1.5)
I am trying to use the XML SQL Utility for Java (Oracle 8.1.5) to obtain a DTD or XML schema for tables in our database.
I have installed the XSU111.ZIP archive,
set the CLASSPATH and stuff, loaded the JAR
files (xmlparserv2.jar, oraclexmlsql.jar)
processed the xmlgenpkg.sql script (following the installation instructions)
When I execute the samples in Java, the JVM (JDK 1.2.2) crashes in javai.dll.
The same error occurs when I run java OracleXML getXML ....
The installation file (env.bat) lists the JDBC driver ZIP as CLASSES12.ZIP, which is of course, not available for 8.1.5, which is what the download instructions indicated is appropriate for XSU 1.1.1.
Any ideas? Do I need to upgrade to 8.1.6?
Can I patch the JDBC with classes12.ZIP.
By the way, when I execute the commands in PL/SQL using xmlgen package, everything is fine.
Regards and Much thanksSet JDK_HOME to the directory where you install your JDK (Java Development Kit).
So instance, I've install JDK1.1.8 on my
C drive so
set JDK_HOME=c:\jdk1.1.8;c:\jdk1.1.8\bin
Maybe you are looking for
-
ICloud: reminders in iCal all over the place, unable to sort
Since I have switched my .me account to iCloud I have been unable to auto sort reminders in iCal on my Mac by date as I used to be able to before the switch. Before I had the option to sort by date when I clicked on the small triangle on the right si
-
Magic Mouse: Eneloop Really More Cost Effective than Lithium?
Hi. Under heavy use, gaming or doing professional work for 16 hours a day at most is it really more environment friendly and cost effective to put Lithium disposable batteries like Everyready's Ultimate? Supposing you used a calculated cost of having
-
I want to know how i can see the remittance advice form layout what is the procedure for issue of of remittance advice to the vendors. I have checked it by using F110 transation for automatic payment but the output is in the report form but i want th
-
How to run VI without the DAQ card connected to the labtop
This may be a silly question but I want to have the answer and couldn't find the answer for spending time in searching in the web. I want to run the VI that controls the intruments in my labtop. The VI was run in a destop that has a DAQ card in the P
-
Preview is fine, upload is not
I am new to Flash ( I am using Flash 8 Pro for Macintosh), and I have gone through the process of teaching myself to create a small photo gallery by creating thumbnails that are buttons and assigning each a small movie (basically a way of displaying