wood burning stoves 2.0*
The moose likes JDBC and the fly likes not able to insert xml file in oracle database using java(only first three lines are inserting) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "not able to insert xml file in oracle database using java(only first three lines are inserting)" Watch "not able to insert xml file in oracle database using java(only first three lines are inserting)" New topic
Author

not able to insert xml file in oracle database using java(only first three lines are inserting)

ripu sudan
Greenhorn

Joined: Dec 07, 2010
Posts: 20

Hi everyone,

I need to insert a large xml file (>=4k) in oracle database using java and i am using following program.but it is inserting only first three line as given blow however characters in file are about 4k.


code i am using
and datatype is CLOB
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3610
    
  60

You can use simple setString if the CLOB is under 32 KB. (That is, read the file into memory and then use setString).

See also an older post of mine (and another one) where I've discussed how to insert a BLOB. CLOB can be done in the same manner, just use the setCharacterStream() instead of setBytes().

I don't know exactly why your solution doesn't work. The ones I'm posting here are tried and tested. Other approaches, perhaps even database independent, are certainly possible too, but I didn't ever need anything else.
ripu sudan
Greenhorn

Joined: Dec 07, 2010
Posts: 20


Hi geeks complete xml was inserted in database ,problem was in viewing file from database ,after setting some parameters i am able to see xml file.
here are parameters which is set in putty console.

set long 9999
set pagesize 50000
set linesize 157

program is working fine...

 
wood burning stoves
 
subject: not able to insert xml file in oracle database using java(only first three lines are inserting)