Hi, Is there a way where I can store the result of the query as a InputStream rather than a string. The reason for me to store it as InputStream is that .. the method I am using to process the resultset accepts inputstream only. right now I have to save the data of the resultset as a file and then get the data from the file in the same program. Could anyone pls help me Thanks
Thomas Paul
mister krabs
Ranch Hand
Joined: May 05, 2000
Posts: 13974
posted
0
If you need to pass the entire ResultSet as one Stream then you can build a String and then create a java.io.StringBufferInputStream object. If you want to pass individual columns then you can use either ResultSet.getAsciiStream() or ResultSet.getBinaryStream(). Both of those will take only one column at a time specified by using either an int (column number) or String (column name).
The problem is that the creation of a new ByteArrayInputStream is inside the while loop. bais will end up only with data from the last row. How about something like this. I didn't get a chance to try it out but I think it should work.
[This message has been edited by Thomas Paul (edited January 11, 2001).]
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.