deleteDb("lob");
Connection conn;
conn = reconnect(null);
conn.createStatement().execute("CREATE TABLE TEST(ID IDENTITY, C CLOB)");
PreparedStatement prep = conn.prepareStatement("INSERT INTO TEST(C) VALUES(?)");
prep.setCharacterStream(1, new CharArrayReader("Bohlen".toCharArray()), "Bohlen".length());
prep.execute();
prep.setCharacterStream(1, new CharArrayReader("B\u00f6hlen".toCharArray()), "B\u00f6hlen".length());
prep.execute();
prep.setCharacterStream(1, getRandomReader(501, 1), -1);
prep.execute();
prep.setCharacterStream(1, getRandomReader(1501, 2), 401);
prep.execute();
conn = reconnect(conn);
ResultSet rs = conn.createStatement().executeQuery("SELECT * FROM TEST ORDER BY ID");
rs.next();
assertEquals("Bohlen", rs.getString("C"));
assertEqualReaders(new CharArrayReader("Bohlen".toCharArray()), rs.getCharacterStream("C"), -1);
rs.next();
assertEqualReaders(new CharArrayReader("B\u00f6hlen".toCharArray()), rs.getCharacterStream("C"), -1);
rs.next();
assertEqualReaders(getRandomReader(501, 1), rs.getCharacterStream("C"), -1);
Clob clob = rs.getClob("C");
assertEqualReaders(getRandomReader(501, 1), clob.getCharacterStream(), -1);
assertEquals(501, clob.length());