• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Saving an XML to DB

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi everyone

I have a formfile object which has an XML which is uploaded from the UI
I need to save this in to a DB
Can anyone suggest the best way to do this
The XML is going to be very huge,And we also dont have a table structure(like a bean) which can hold this

Please suggest
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should use a CLOB field for this. The name for the field type may differ though; MS SQL Server calls it "text" (or "ntext for Unicode) for instance.
After that you use PreparedStatement with setCharacterStream / setClob (or setNCharacterStream / setNClob for Unicode text fields). You can use a StringReader to convert a String into a Reader if necessary.
reply
    Bookmark Topic Watch Topic
  • New Topic