hi,
there's a servlet in another webserver I have to connect to via an URL. the servlet returns an XML as a servlet response (stream). I need to send this XML as CLOB datatype into Oracle 9i database.
I need to get the InputStream into the Oracle CLOB datatype, without saving it into a file first.
Here's what I have come up with so far:
url1= new URL ("https://blahblah");
istream = url1.openStream();
char[] buffer = new char[size];
InputStreamReader reader = new InputStreamReader(istream);
for (int charRead = reader.read(buffer); charRead > -1; charRead = reader.read(buffer)) {
// here I need to write into CLOB
}
any ideas?
-
how to get XML from InputStream to Oracle CLOB format? (1 messages)
- Posted by: Oskar Juhe
- Posted on: June 16 2005 03:30 EDT
Threaded Messages (1)
- Re: how to get XML from InputStream to Oracle CLOB format? by Nathan Smith on June 16 2005 19:32 EDT
-
Re: how to get XML from InputStream to Oracle CLOB format?[ Go to top ]
- Posted by: Nathan Smith
- Posted on: June 16 2005 19:32 EDT
- in response to Oskar Juhe
Not tested, but something like this should do it:
CLOB myClob = CLOB.createTemporary(connection, false, CLOB.DURATION_CALL);
Writer clobWriter = myClob.getCharacterOutputStream();
// Write from Reader to Writer here
// You can call ps.setClob() with this object
CLOB.freeTemporary(myClob);