hi folks, i want to know that how can we convert an object of any class into string without losing data.Actually i want to store a object into relational database where as that database only takes ascii or string format.So how can i store my object to that database so that i can get back without losing persistence of that object.thanks
Well champ, I'd say that that wouldn't be effective. What you can do is serialize your object, and then you wouldn't store it in the database as a String, but instead, you would physically store it as a regular file. And also, instead of retrieving your object from a database, you would deserialize it from this file. I think this would do what you are looking for.
Assuming you don't want to build special support for each class, the most obvious way is to first serialize the object to a byte using a combination of ByteArrayOutputStream and ObjectOutputStream, then Base64 encode that byte into a String. Don't create a String directly from the byte because it will contain several "characters" that shouldn't go in Strings.