• 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
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

problem in Serialization

 
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi..
I just want to know how to save the seriliazed object in database..
I am able to save in a text file & can reterive it.....
please help me out...
Thanks
Vijay
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First, if you're serializing to a file, it's almost certainly not a text file. Unless by "serialization" you mean certain nonstandard forms with comparable functionality, such as XStream. (Which generates nice pretty XML files which definitely qualify as readable text.) Anyway though, standard Java serialization results in binary files, not text. If you want to put a serialized object into a database rather than a file, you probably want to use a BLOB datatype. Java's Blob interface allows you to setBinaryStream() - just write the serialized bytes to the OutputStream, and execute the associated Statement. Most of the remaining details deal with how to use any database in Java - I'd go to the JDBC forum for further details in this area.
 
On my planet I'm considered quite beautiful. Thanks to the poetry in this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic