• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

problem in Serialization

 
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
You’ll find me in my office. I’ll probably be drinking. And reading this tiny ad.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic