count++; buf = (byte) in.read(); } } catch (Exception e) { System.out.println("Error occured while reading stream ... \n"); } }

The example first puts the result of a SELECT statement into a ResultSet object. It then executes the method ResultSet.getBinaryStream() to retrieve the BYTE data into a Java InputStream object.

The method dispValue(), whose Java code is also included in the example, is used to print out the contents of the column to the standard output device. The dispValue() method uses byte arrays and the InputStream.read() method to systematically read the contents of the column of type BYTE.

The TextType.java program shows how to select data from a column of type TEXT. It is very similar to selecting from a column of type BYTE, except the getAsciiStream() method is used instead of getBinaryStream().

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]