M
Mike
Hi
I've already posted it in Oracle group but no answer. But I think the
problem is rather programming not the db.
I think I've read everything about Oracle-Java and i still didn't get
it right.
I am desperate.
I want something as simple as that:
I inserted some documents into this table:
CREATE TABLE xmlDocuments(docId NUMBER, xmlDocum XMLType);
Now i want to retrieve whole documents in my java app and parse it.
I tried lots of combinations.
First tried something that works in SQL2008 and DB2:
qString = "SELECT XMLDOCUM FROM XMLDOCUMENTS;";
rs = st.executeQuery(qString);
and rs has rows but if i getString(1)
while (rs.next())
{ ....
saxParser.parse(new InputSource(new StringReader(rs.getString(1))),
handler); //works with DB2 and MSSQL2008
i get a null pointer exception at saxParser
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;"; //
gives me java.sql.SQLException: ORA-00911: invalid character
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 help me.
Mike
I've already posted it in Oracle group but no answer. But I think the
problem is rather programming not the db.
I think I've read everything about Oracle-Java and i still didn't get
it right.
I am desperate.
I want something as simple as that:
I inserted some documents into this table:
CREATE TABLE xmlDocuments(docId NUMBER, xmlDocum XMLType);
Now i want to retrieve whole documents in my java app and parse it.
I tried lots of combinations.
First tried something that works in SQL2008 and DB2:
qString = "SELECT XMLDOCUM FROM XMLDOCUMENTS;";
rs = st.executeQuery(qString);
and rs has rows but if i getString(1)
while (rs.next())
{ ....
saxParser.parse(new InputSource(new StringReader(rs.getString(1))),
handler); //works with DB2 and MSSQL2008
i get a null pointer exception at saxParser
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;"; //
gives me java.sql.SQLException: ORA-00911: invalid character
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 help me.
Mike