Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
ripu sudan
Greenhorn
Posts: 20
Java Linux Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 20
Java Linux Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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...

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic