hi all,

i have a java code,

here "rs" is a result set.

ByteArrayInputStream byteStream = new ByteArrayInputStream(rs.getBytes(objName));

ObjectInputStream objStream = new ObjectInputStream(byteStream);

obj = objStream.readObject();

return obj;


i cant understand why it is used both "ByteArrayInputStream" and "ObjectInputStream"...?


can't i do this with one inputStream....?

please help me............!

thank you.....

The ObjectInputStream can only be created using another InputStream of some type. A quick look at the API docu would tell you this. So no, you can't. You could combine it all on one line rather than using itermediate statements, but the work done is the same and is only more confusing to look at.

Any particular reason you aren't using JDBC?

it is requered to get the database column into a vector object. i want to know why doing so complex way

insted of this way is it possible to use

rs.getString() method and the returned value can be inserted to the vector object.


is this possible...?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.