getAsciiStream, setAsciiStream
"Bill Champ" <[email protected]>
| Newsgroups | gmane.comp.db.mckoi |
|---|---|
| Message-ID | <[email protected]> |
I'd like to efficiently (low memory usage) copy some potentially large columns of a record from one table to another. I thought to use getAsciiStream() on the ResultSet and use setAsciiStream() on the PreparedStatement to copy the column to the new table. I see that getAsciiStream() returns an InputStream which does not specify how much data is in the stream. However, setAsciiStream() requires you to tell it how many bytes of data are in your stream. Seems like getAsciiStream() does not directly provide all the data one needs in order to use setAsciiStream(). I was hoping to learn that passing -1 or some such thing for the length would tell setAsciiStream() to just wait till the stream is exhausted to learn the length, but no luck. I suppose I could take the InputStream returned by getAsciiStream() and stream the data to a file. Then use a FileInputStream to feed setAsciiStream(), getting the stream size from the File object. Am I missing something or is there a more direct way of using the same stream to pipe the data from the ResultSet to the PreparedStatement? --Bill --------------------------------------------------------------- Mckoi SQL Database mailing list http://www.mckoi.com/database/ To unsubscribe, send a message to [email protected]