The following code fragment shows how a user can retrieve a LONG VARCHAR
column as a stream:
// retrieve data as a stream
ResultSet rs = s.executeQuery("SELECT b FROM atable");
while (rs.next()) {
// use a java.io.Reader to get the data
java.io.Reader ip = rs.getCharacterStream(1);
// process the stream--this is just a generic way to
// print the data
char[] buff = new char[128];
int size;
while ((size = ip.read(buff)) != -1) {
String chunk = new String(buff, 0, size);
System.out.print(chunk);
}
}
rs.close();
s.close();
conn.commit();