Hi
I think I've read everything about Oracle-Java. It's 6 A.M. and still
not geting it right.
I am desperate.
I want something as simple as that:
I inserted some documents into this wonderful table:
CREATE TABLE xmlDocuments(docId NUMBER, xmlDocum XMLType);
Now i want to retrieve whole documents in my java app and parse it in
my app.
I tried lots of combinations.
First tried something that works in SQL2008 and DB2 (with some simple
modifications - encoding):
qString = "SELECT XMLDOCUM FROM XMLDOCUMENTS;";
rs = st.executeQuery(qString);
but not in Oracle XE - rs has rows but if i use getString(1) as i
would always do:
while (rs.next())
{ ....
saxParser.parse(new InputSource(new
StringReader(rs.getString(1))), handler); //works with DB2 and
MSSQL2008
i get a null pointer exception
I system.out the rs.getString(1) instead of parsing it and it prints:
null
So i started to read about oracle and xml an came to this:
qString = "SELECT t.xmlDocum.getStringVal() FROM xmlDocuments t;"; //
java.sql.SQLException: ORA-00911: invalid character
then this:
qString = "SELECT SYS_XMLGEN(XMLDOCUM) FROM XMLDOCUMENTS;" //no
results again
And if i use these queries in oracle command line tool:
SELECT t.xmlDocum.getStringVal() FROM xmlDocuments t;
SELECT XMLDOCUM FROM XMLDOCUMENTS;
SET LONG 10000;
SELECT XMLDOCUM.getStringVal() FROM XMLDOCUMENTS;
oracle gives me my documents. Connecting sys as sysdba from both java
and cmd.
i am using: oracle.jdbc.pool.OracleDataSource driver/connection:
OracleDataSource ds;
ds = new OracleDataSource();
ds.setURL(url);
conn = ds.getConnection(username, password);
connection works and I get other results:
SELECT count(*) from XMLDOCUMENTS;
i get 4 because 4 docs are in the table right now.
Please, please, please help me. I don't have any clues.
Mike
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"oracle" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/oracle
-~----------~----~----~----~------~----~------~--~---