posted 11 years ago
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.