Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #21714

Re: Oracle - java - get xmlType col into resultset

Newsgroups comp.lang.java.programmer
Date 2013-01-25 11:50 -0800
References <84fdf877-41d9-4290-8cd8-c6354de90e11@26g2000hsk.googlegroups.com> <badac4hbkfrn9cjtabe7803ns9gcshdn71@4ax.com> <2a9c1eaa-ddb9-4612-b852-8c0fe3134fd1@x35g2000hsb.googlegroups.com> <1ac4c4b1-9a54-478a-969f-367d5f2a8ef3@b1g2000hsg.googlegroups.com>
Message-ID <5015f905-98f9-4da8-9e8c-19523eda5ac5@googlegroups.com> (permalink)
Subject Re: Oracle - java - get xmlType col into resultset
From rajashekar.katla01@gmail.com

Show all headers | View raw


On Tuesday, September 9, 2008 11:21:46 PM UTC+1, Mike wrote:
> got it!!
> i use this query:
> 
> queryString = "select x." + column + ".getStringVal() from " + table +
> " x";
> 
> and then:
> 
> saxParser.parse(new InputSource(new StringReader(rs.getString(1))),
> handler);
> and rs.getString(1) gives me full xml document
> 
> once again than you for all your help
> Mike
> 
> 
> On 9 Wrz, 23:57, Mike <darthvadertojabuahahah...@gmail.com> wrote:
> > On 8 Wrz, 16:27, Tim Slattery <Slatter...@bls.gov> wrote:
> >
> >
> >
> > > Mike <darthvadertojabuahahah...@gmail.com> wrote:
> > > >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
> >
> > > This page might help:http://www.oracle.com/technology/sample_code/tech/java/codesnippet/js...
> >
> > > --
> > > Tim Slattery
> > > Slatter...@bls.govhttp://members.cox.net/slatteryt
> >
> > Hello
> > Thank you for your help.
> > I tried both solutions and both of them didn't work:
> >
> > 1.
> > I get exception when using getCharacterStream:
> > java.sql.SQLException: Niepoprawny typ kolumny: getCharacterStream not
> > implemented for class
> >
> > oracle.jdbc.driver.T4CNamedTypeAccessor
> >
> > 2.
> > and there is no method:
> > registerOutParameter (1, OracleTypes.OPAQUE,"SYS.XMLTYPE");
> > in new Oracle driver (no OracleCallableStatement)
> >
> > any other ideas how to solve this problem?
> > Mike

Thank you so much for posting the solution here, it saved my time.
Take care...
-Raj

Back to comp.lang.java.programmer | Previous | Next | Find similar | Unroll thread


Thread

Re: Oracle - java - get xmlType col into resultset rajashekar.katla01@gmail.com - 2013-01-25 11:50 -0800

csiph-web