OracleXMLSave
I'm getting an error on this line of code:
OracleXMLSave oxs = new OracleXMLSave(conn,"newsstoryview");
conn is a connection to an oracle database using jdbc:oracle:thin and "newsstoryview" is the name of a view.
Exception breakpoint occurred at line 204 of URLClassLoader.java.
java.lang.ClassNotFoundException: oracle.xdb.XMLType
Warning: The debugger has stopped in a class where tracing is disabled.
Because of the tracing options set in your project, Step Over is not available in this class.
If you wish to step through this class, please update your tracing options by choosing Tracing... from the context menu in the Classes window.
anyone experience this before?
I also get this error if I run the class instead of running in debug mode
Exception in thread main
java.lang.NoClassDefFoundError: oracle.xdb.XMLType
at mypackage2.MoreoverIntoNewsstory.main(MoreoverIntoNewsstory.java:43)
Line 43 is the line that does OracleXMLSave oxs = new OracleXMLSave(conn,"newsstoryview");
Similar Messages
-
OracleXMLSave - Insert into table with NOT NULL Columns
Im having trouble using OracleXMLSave (XSU12) to insert into a
table where columns are initialized on insert with system
derived values (see table script below) I get the following
error message.
Message: 'java.sql.SQLException: ORA-01400: cannot insert
NULL "TESTMEETING"."S_TERMID")
Im inserting this XML:
<ROWSET table="testmeeting">
<ROW>
<DESCRIPTION>TestMeeting</DESCRIPTION>
<STARTDATE>2001-10-22 00:00:00.0</STARTDATE>
<CATEGORYCODE>HR</CATEGORYCODE>
<STATUS>O</STATUS>
</ROW>
</ROWSET>
Table Script:
CREATE TABLE TESTMEETING (
S_TERMID VARCHAR2 (12) DEFAULT (USERENV('TERMINAL'))
NOT NULL,
S_RECORDCREATED DATE DEFAULT (SYSDATE) NOT NULL,
S_RECORDCREATOR NUMBER (4) DEFAULT (UID) NOT NULL,
DESCRIPTION VARCHAR2 (28),
CATEGORYCODE VARCHAR2 (2),
STARTDATE DATE,
STATUS VARCHAR2 (1))
If I remove these columns the insert works OK. Inserts also work
fine from sqlplus etc.
Apologies for the previous entry, itchy fingers.
Thanks for your helpHi.
try to insert data in column "TESTMEETING"."S_TERMID" by trigger.
Thanks.. -
Error: Unparseable date with OracleXMLSave
Hi,
Error:
oracle.xml.sql.OracleXMLSQLException: java.text.ParseException: Unparseable date: "03/18/2099"
int oracle.xml.sql.dml.OracleXMLSave.insertXML(org.w3c.dom.Document)
void b2b.RcvQueueListener.saveCsmToTso(oracle.xml.parser.v2.XMLDocument)
void b2b.RcvQueueListener.<init>()
void b2b.RcvQueueListener.main(java.lang.String[])
I've tried to save a row in the database with OracleXMLSave:
I use JDeveloper 3.1.1.2 with XDK 2.? and a local Oracle 8.1.6 unde NT.
// XML Doc:
<ROWSET>
<ROW NUM="1">
<CSM_NO>A29912</CSM_NO>
<CRE_DAY_CSM>03/18/2099</CRE_DAY_CSM>
<CSM_VOL_GRO_FRZ>59.89</CSM_VOL_GRO_FRZ>
</ROW>
</ROWSET>
// Set java enviroment:
Locale.setDefault(java.util.Locale.US);
// Save Data with XSU like:
OracleXMLSave sav =
new OracleXMLSave(cn.getConnection(), "consignment_t");
sav.insertXML(csmData);
Same Error when trying to...
(1) set date format for OracleXMLSave:
> sav.setDateFormat("DD/MM/YYYYY");
(2) set database parameter:
> nls_date_format='DD/MM/YYYY';
> nls_language='AMERICAN';
(3) set registry (winnt)
> nls_lang=AMERICAN_AMERICA.WEISO8859P1
Help would be appreciated.
Thanks in advance!
Matthias.setDateFormat() is expecting a format mask that is valid for the java.text.SimpleDateFormat object.
So, just do:
setDateFormat("d/M/yyyy");
null -
Java Error Message When Using an instance of OracleXMLSave
Hi,
I am trying to use the XDK XML-SQL utility to insert data from an xml file into a table.
I am using eclipse and imported the following jar files into the java build path from jdeveloper
xml.jar
xmlmesg.jar
xsu12.jar
When I try to run my test program I get the following error message:
java.lang.NoClassDefFoundError: oracle/xdb/XMLType
at this line in the program:
OracleXMLSave sav = new OracleXMLSave(conn, "EDG_EPC.EMP_PRACTICE");
What could I be doing wrong? Do I need to import more libraries. If so where are they located in jdev? Additionally, does the table need to be of XMLType??? I thought the XDK would work for inserting into regular tables.
Please help!!!!!
Thanksjava.lang.NoClassDefFoundError: oracle/xdb/XMLType
Add <Oracle10g>/RDBMS/jlib/xdb.jar to Classpath. -
Memory leak in OracleXMLSave?
I always get a Out of Memory : Java heap space
at oracle.xml.sql.dml.OracleXMLSave.saveNodeVal(OracleXMLSave.java:2854)
at oracle.xml.sql.dml.OracleXMLSave.saveNodes(OracleXMLSave.java:2650)
at oracle.xml.sql.dml.OracleXMLSave.saveXML(OracleXMLSave.java:2534)
at oracle.xml.sql.dml.OracleXMLSave.insertXML(OracleXMLSave.java:1454)
after processing 3.5 million rows, no matter if this set was processed in rows of 10k or 100k or 1m.
each time the OracleXMLSave is nulled after each subset.
Usiing 10.2.0.2.0.
Is there a memory leak?
PS: What does cleanLobList() do?
Any advice?
Thanksok... I JProbed the app, and I got a 60% bulk of Object[], followed by Strings, and then XMLText and XMLNodes.
The Object[]s used grows but do not seem to be discarded when the data set shrinks. I see about 25% of these having much less references in my snapshot, while the rest have about the same number of references.
Is there going to be new Oracle XDK releases? -
Answer: OracleXMLSave and SDO_GEOMETRY type
I am generating XML data from table that contains SDO_GEOMETRY datatype using XSU utility, it works fine.
But then I trying to insert those data into other table with exactly same structure using OracleXMLSave.insertXML(..) it returns following error:
oracle.xml.sql.OracleXMLSQLException: 'getArrayVal: Internal Error -- '8 != 2'' encountered during processing ROW element 0. All prior XML row changes were rolled back. in the XML document.
int oracle.xml.sql.dml.OracleXMLSave.saveXML(org.w3c.dom.Document, int)
int oracle.xml.sql.dml.OracleXMLSave.saveXML(java.net.URL, int)
int oracle.xml.sql.dml.OracleXMLSave.insertXML(java.net.URL)
void ca.teranet.db.xml.ProcessXML.main(java.lang.String[])
Process exited with exit code 1.
When I comment out sdo_geometry datatype it works fine.
table
Name Type
GDO_GID NUMBER(38)
TERA_GID VARCHAR2(14)
TYPE VARCHAR2(1)
POLBLK VARCHAR2(5)
LRO_ID VARCHAR2(2)
CREATE_DATE DATE
RETIRE_DATE DATE
STATE VARCHAR2(1)
GEOM MDSYS.SDO_GEOMETRY
GM_TEXT BLOB
TEXT_ANGLE FLOAT(126)
LABEL VARCHAR2(50)
FCODE VARCHAR2(20)
ORA_VALID VARCHAR2(10)
SDE_VALID VARCHAR2(1)
XML File:
<?xml version = '1.0'?>
<ROWSET>
<ROW num="1">
<GDO_GID>158</GDO_GID>
<TERA_GID>000030060</TERA_GID>
<TYPE>P</TYPE>
<POLBLK>00003</POLBLK>
<LRO_ID>41</LRO_ID>
<CREATE_DATE>6/6/1996 13:54:51</CREATE_DATE>
<RETIRE_DATE NULL="TRUE"/>
<STATE>C</STATE>
<GEOM>
<SDO_GTYPE>2001</SDO_GTYPE>
<SDO_SRID>8265</SDO_SRID>
<SDO_POINT>
<X>-80.8255177207051</X>
<Y>42.9976199216779</Y>
<Z NULL="TRUE"/>
</SDO_POINT>
<SDO_ELEM_INFO NULL="TRUE"/>
<SDO_ORDINATES NULL="TRUE"/>
</GEOM>
<GM_TEXT>C9FFD20FBC8CCF11ABDE08003601B769982C4748D53454C0E4B87402B27F45400000000000000000D60D50692694284000000000000000000000000000000000000000000000F03F0000010009000000303030303330303630</GM_TEXT>
<TEXT_ANGLE NULL="TRUE"/>
<LABEL>000030060</LABEL>
<FCODE>TOWPCE</FCODE>
<ORA_VALID>Y</ORA_VALID>
<SDE_VALID>Y</SDE_VALID>
</ROW>
</ROWSET>
I appreciate any comments.
Thanks
George.
Answer:
The code works fine on 9iR2 Database. Would you please specify the XSU version, Database Version and JDBC libs Version?I've tried to investigate more.
I've created folloving DB object in SCOTT schema
create type emp_col as array(100) of varchar2(10);
create type o_emp as object (
empname varchar2(10),
empaddres varchar2(10),
empcol emp_col);
create table obj_emp (
id number,
info o_emp);
and I've used same java code to insert attached XML file into obj_emp table:
<?xml version = '1.0'?>
<ROWSET>
<ROW num="1">
<ID>1</ID>
<INFO>
<EMPNAME>bbbb</EMPNAME>
<EMPADDRES NULL="TRUE"/>
<EMPCOL>
<EMPCOL_ITEM>111</EMPCOL_ITEM>
<EMPCOL_ITEM>222</EMPCOL_ITEM>
</EMPCOL>
</INFO>
</ROW>
</ROWSET>
And I found inconsistent behaviour:
if type emp_col is defined as array of varchar2 it is OK
if I've changed emp_col type to array of number - it returned same ugly error:
oracle.xml.sql.OracleXMLSQLException: 'getArrayVal: Internal Error -- '8 != 2'' encountered during processing ROW element 0. All prior XML row changes were rolled back. in the XML document.
at oracle.xml.sql.dml.OracleXMLSave.saveXML(OracleXMLSave.java:2298)
at oracle.xml.sql.dml.OracleXMLSave.saveXML(OracleXMLSave.java:2175)
at oracle.xml.sql.dml.OracleXMLSave.insertXML(OracleXMLSave.java:1264)
at ca.teranet.db.xml.ProcessXML2.main(ProcessXML2.java:20)
Note. Spatial type SDO_GEOMETRY is contains SDO_ELEM_INFO type that is array of number.
Could you someone explain this?
Thanks
George. -
How can i insert pseudocolumn (sequencename.nextval) with oracleXmlSave?
how can i insert pseudocolumn value (sequencename.nextval) with oracleXmlSave.insertXml(xmlfile)?
if anyone know it, pls post the answer to the bbs or reply me: [email protected]
thank u so much.You can create a trigger on the table and insert your sequence no from there or create a updateable view and create insted off trigger to populate your columns. I am new to XML, but I think this the way you can do it esealy. Or may be this the only way.
-
[XSU] OracleXMLSave
Hi!
I have a problem with loading XML file with OracleXMLSave.
I would to load an XML file 2 levels deep in an object-relational table in Oracle 9.2.0.1
the problem is generating the right schema DB for sustain the 2 level deep XML file.
my file is like this:
<person>
<name>alex</name>
<face>
<eyes>green</eyes>
<hair>brown</hair>
</face>
</person>
I created this schema DB on Oracle:
CREATE TYPE face_type AS OBJECT
("eyes" VARCHAR2(10),"hair" VARCHAR2(10))
CREATE TYPE person_type AS OBJECT
("name" VARCHAR2(20),"face" FACE_TYPE)
CREATE TABLE person_tab (person PERSON_TYPE)
my java code:
OracleXMLSave sav= new OracleXMLSave(...);
sav.setRowTag("person");
sav.setIgnoreCase(true);
sav.insertXML(<person><name>alex</name><face><eyes>green</eyes><hair>brown</hair></face></person>);
the problem:
the code don't generate exceptions or errors but the result in the table is not what I expected,in fact
the output of the below code
OracleXMLQuery qry = new OracleXMLQuery(con, "select * from PERSON_TAB");
String output = qry.getXMLString();
is:
<?xml version = '1.0'?>
<ROWSET>
<ROW num="1"/>
<ROW num="2"/>
</ROWSET>
(a <ROW> like these ones above for each inserXML(...))
Can somebody help me please? because I tried many and many times to understand where is the problem unsuccessfully :(
.Chucky.I did the following test. How is your case different from this one below?
SQL> create table tt (n number);
Table created.
SQL> create table tt2( n number );
Table created.Then I wrote the Java program below:
import java.sql.*;
import java.io.*;
import oracle.xml.sql.dml.*;
import oracle.xml.parser.v2.*;
import org.w3c.dom.Document;
class TBone {
final static String xml =
"<ROWSET><TT><N>1</N></TT><TT2><N>2</N></TT2></ROWSET>";
public static void main (String arg[]) throws Exception {
Connection cn = ConnectionHelper.getConnection();
OracleXMLSave tt = new OracleXMLSave(cn,"TT");
OracleXMLSave tt2 = new OracleXMLSave(cn,"TT2");
DOMParser p = new DOMParser();
p.parse(new StringReader(xml));
Document d = p.getDocument();
tt.setRowTag("TT");
int rows = tt.insertXML(d);
System.out.println(rows+" rows inserted into TT");
tt2.setRowTag("TT2");
rows = tt2.insertXML(d);
System.out.println(rows+" rows inserted into TT2");
cn.close();
}and I get the output:
1 rows inserted into TT
1 rows inserted into TT2
and I correctly get a row with number 1 inserted into table TT and a row with number 2 inserted into table TT2. -
Problem Inserting into object view with OracleXmlSave
Gurus,
I'm trying to insert into an object view with
multiple collections of objects representing a master/detail relationship and a CLOB column, but I've this error:
oracle.xml.sql.OracleXMLSQLException: Error Interno
at oracle.xml.sql.dml.OracleXMLSave.saveXML(OracleXMLSave.java:1967)
at oracle.xml.sql.dml.OracleXMLSave.insertXML(OracleXMLSave.java:1060)
at onix.interface_isbn.OnixXmlLoader.doInsert(OnixXmlLoader.java:165)
at onix.interface_isbn.OnixXmlLoader.setLoader(OnixXmlLoader.java, Compiled Code)
at onix.interface_isbn.OnixXmlLoader.<init>(OnixXmlLoader.java:23)
at onix.interface_isbn.correrLoader.main(correrLoader.java:77)
I'm using OracleXmlSave with insertXML method to do this.
Is There any limitations to do that? (example
number of tables into the view, columns datatype).
I'd appreciate any comments
ThankNo known limitations. Please post the sample DDL to create your object types and object view, along with an example of the example XML document you're trying to insert.
-
Error in OracleXMLSave !!
I have this error while trying to insert a row in a table.
My 'document' is valid and also my connection
Tips?
Thks
Leonardo
oracle.xml.sql.OracleXMLSQLException: sun.jdbc.odbc.JdbcOdbcConnection
at oracle.xml.sql.dml.OracleXMLSave.saveXML(OracleXMLSave.java:1904)
at oracle.xml.sql.dml.OracleXMLSave.insertXML(OracleXMLSave.java:1028)
at com.lulli.WebBeans.InsertBeanJDBC.InsertDOMoracle(InsertBeanJDBC.java
:84)
nullI'm experiencing the same problems with MS ACCESS 97 and IBM DB2.
I have also tried a 'select' before the 'insert' to be sure everything works,
here's the result
<?xml version = '1.0'?>
<ROWSET>
<ROW num="1">
<CODICE>1</CODICE>
<BRANCH>sdb vr</BRANCH>
<TIPO>o</TIPO>
</ROW>
<ROW num="2">
<CODICE>2</CODICE>
<BRANCH>sdb to</BRANCH>
<TIPO>0</TIPO>
</ROW>
</ROWSET>
record<?xml version="1.0"?><ROWSET><ROW num="3"><CODICE>44</CODICE><BRANCH>eccomi</BRANCH><TIPO>C</TIPO></ROW></ROWSET>
Bean COM.ibm.db2.jdbc.app.DB2Connection
Bean 0
Bean ERROR<ERROR>
COM.ibm.db2.jdbc.app.DB2Connection</ERROR>
Bean SQL ERROR<ERROR>
<MESSAGE>
COM.ibm.db2.jdbc.app.DB2Connection </MESSAGE>
</ERROR>
oracle.xml.sql.OracleXMLSQLException: COM.ibm.db2.jdbc.app.DB2Connection at oracle.xml.sql.dml.OracleXMLSave.saveXML(OracleXMLSave.java:1904) at oracle.xml.sql.dml.OracleXMLSave.insertXML(OracleXMLSave.java:1028) at InsertXMLData.doGet(InsertXMLData.java:75)
Thks in advance
Leonardo -
JDBC equivalent of OracleXMLSave.setDateFormat()?
The Orace XSU class OracleXMLSave has a method setDateFormat().
How can I accomplish the equivalent in JDBC?
The NSL_DATE_FORMAT of my server "RRRR-MM-DD HH24:mm:ss"
I have a bunch of ASCII files I'm trying to load which have "MM/DD/YYYY" format.
In PL/SQL and/or Oracle XSU I just set the date format and then execute something like
insert into myfile columns ( mydatecol ) values '01/01/1999' )
However, when using JDBC I haven't figured out how to set the date format for the session/connection/whatever globally.
I know I can use JDBC date escaping BUT that requires I know which columns are dates. If I can just set the format for the session to match the load file I only have to provide columns names and values (as strings).
R.Parr
Temporal ArtsNone by default.
You could use REF CURSOR as an OUT parameter of a stored procedureCREATE OR REPLACE PACKAGE myPkgGetCursor IS
TYPE recSet IS REF CURSOR;
PROCEDURE getList( recList OUT recSet, param1 IN NUMBER);
END myPkgGetCursor;
CREATE OR REPLACE PACKAGE BODY myPkgGetCursor AS
PROCEDURE getList( recList OUT recSet, param1 IN NUMBER) IS
BEGIN
OPEN recList FOR <queryStatement>;
END getList;
END myPkgGetCursor;Use CallableStatement and specify myPkgGetCursor.getList -
Using OracleXMLSave for nested date
I am trying to insert an XML document containing the following date structure into Oracle using the OracleXMLSave class. Is there a way to do this without reformatting the date into a single element beforehand? Here is the stucture.
<expiration-date>
<expiration-year>2000</expiration-year>
<expiration-month>12</expiration-month>
<expiration-day>31</expiration-day>
</expiration-date>
Any help appreciated!
KurtHi try this
sql> select to_char(sr.recievedat, 'FMDD Mon yyyy fmHH24:MI') from dual;example
SQL> select to_char(to_date('01-jan-2009 7:01:06','dd-mon-rrrr HH:MI:SS'), 'FMDD Mon yyyy fmHH24:MI'
) from dual;
TO_CHAR(TO_DATE('01-JAN
1 Jan 2009 07:01 -
I've based an application on Steve Muench's "Advance XML Loading Techniques" (Ch. 14, Oracle XML applications).
If the XML text is too large for a database column, I don't get any exception raised when I run OracleXMLSave but the insert fails with ORA-00000. I was hoping that a specific error would be raised for this problem.
I've seen how to constrain numbers in an XML schema - is it possible to constrain strings to a specified size?
Code fragment:
if (table != null && insDoc.getDocumentElement().getFirstChild() != null) {
try {
// Create the XMLSave object and pass current ROWSET doc and tablename
OracleXMLSave xs = new OracleXMLSave(conn,table);
xs.setCommitBatch(1);
xs.setIgnoreCase(false);
if (dateFormat != null) {
xs.setDateFormat(dateFormat);
int rows = xs.insertXML(insDoc);
xs.close();
catch (oracle.xml.sql.OracleXMLSQLException ex) {
// If we're ignoring errors, then note the error and continue.
if (ignoreErrors) {
System.out.println(formatted(itemsHandled)+": Ignoring, ORA-" +
formatted(ex.getErrorCode()) + " on table " + table);
else {
throw ex;In XML Schema, you can use <xsd:restriction/> in the Simple Content to specify the length of the string.
-
Inserting XML encoded ampersands into tables with OracleXMLSave / XMLLoader
Hi,
I've an XMLLoader application based on Steve Muench's design.
My client has given me XML documents with XML encoded ampersands.
The XMLloader (OracleXMLSave) is treating the ampersand as a substitution token and is adding chunks of unexpected text when it inserts the strings containing ampersands.
How do I turn off the substition within the JDBC?
Thanks,
Steve.If your XML Document looks like:
<ROWSET>
<ROW>
<FIELD1>val-1</FIELD1>
<FIELD12>val-12</FIELD12>
</ROW>
</ROWSET>
it will insert into just those two
fields, the rest will be null for
the purposes of the insert. -
Trouble with OracleXMLSave ...
Hello everybody,
I would like to know what is problem with this part of code. Result of that code is error in
OracleXMLSave save = new OracleXMLSave(conn, tabName);
row of code and is like this:
java.lang.NoClassDefFoundError: oracle/jdbc2/Clob.
I'm using ojdbc14.jar and the newest Oracle XDK. Here is code:
import oracle.xml.sql.dml.*;
import java.sql.*;
import oracle.jdbc.driver.*;
import oracle.jdbc.*;
import java.net.*;
public class XmlWriteDB {
public static void main(String args[]) throws SQLException {
String serverName = "serverName";
String portNumber = "portNumber";
String sid = "sid";
String url_jdbc = "jdbc:oracle:thin:@" + serverName + ":" + portNumber
+ ":" + sid;
String username = "username";
String password = "password";
String tabName = "tabName"; // Table into which to insert XML data
String fileName = "fileName"; // XML document filename
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
// Initialize a JDBC connection
Connection conn = DriverManager.getConnection(url_jdbc, username, password);
// Insert XML data from file (filename) into
// database table (tabName)
OracleXMLSave save = new OracleXMLSave(conn, tabName);
URL url = save.createURL(fileName);
int rowCount = save.insertXML(url);
System.out.println(" successfully inserted "+rowCount+
" rows into "+ tabName);
conn.close();
thank you for all your help
Jan :)java.lang.NoClassDefFoundError: oracle/jdbc2/Clob.Your classpath is wrong.
I'm using ojdbc14.jar and the newest Oracle XDK.If oracle.jdbc2.Clob is in that jar, then make sure the jar is in your classpath.
Maybe you are looking for
-
Safari 5 opens briefly then crashes at launch
I click the Safari icon in the dock and it jumps like it is going to open. A small safari window pops up and then quickly disappears but it is like the application is running in the background with no visible browser window. Here is the last crash re
-
Problem on Multi based queries
Hi,gurus, I have two DSO(BI 7.0), ZDSO1 and ZDSO2, in ZDSO1, there are three characteristics ZCH01, ZCH02, ZCH03 and one key figure ZKF01, the key is ZCH01, while in ZDSO2, there are three characteristics ZCH01, ZCH04, ZCH05 and one key figure ZKF
-
I need to download a programmer (I believe it is called Impact) to program a platform flash attached to a spartan-6 device. I do not need development tools. What tool should I download to be able to program using a platform cable USB2?
-
LabVIEW Crashes While Loading Project
Hey All, I have an interesting issue here where I try to load a large project, and somewhere near the end LabVIEW just disappears. I'm running the latest version of LabVIEW 2010 (Just Updated) on Windows 7 Professional 64.\ The project has RT and FPG
-
I've updated my Iphone but cannot activate it? When I try through wifi it says the activation server is unavailable try later and I've been doing this for 5 hrs now. When I try to activate it through Itunes it says there's no SIM in the phone when