Java Code Examples for java.sql.Clob#setCharacterStream()

The following examples show how to use java.sql.Clob#setCharacterStream() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: gemfirexd-oss   File: LobStreamsTest.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Tests the ClobWriter.write(char cbuf[], int off, int len) method
 **/
public void testClobCharacterWrite3ParamChar() throws Exception
{
    char[] testdata = unicodeTestString.toCharArray();

    PreparedStatement stmt3 = prepareStatement(
        "SELECT c FROM testBlobX1 WHERE a = 1");
    ResultSet rs3 = stmt3.executeQuery();
    rs3.next();
    Clob clob = rs3.getClob(1);
    assertTrue("FAIL -- clob is NULL", clob != null);
    Writer clobWriter = clob.setCharacterStream(1L);
    clobWriter.write(testdata, 0, testdata.length);
    clobWriter.close();

    PreparedStatement stmt4 = prepareStatement(
        "UPDATE testBlobX1 SET c = ? WHERE a = 1");
    stmt4.setClob(1,  clob);
    stmt4.executeUpdate();
    stmt4.close();

    rs3.close();
    rs3 = stmt3.executeQuery();

    assertTrue("FAIL -- clob not found", rs3.next());
    long new_length = rs3.getClob(1).length();
    assertEquals("FAIL -- wrong clob length",
            testdata.length, new_length);

    // Check contents ...
    Reader lStream = rs3.getClob(1).getCharacterStream();
    assertTrue("FAIL - Clob and buffer contents do not match",
            compareClobReader2CharArray(testdata, lStream));

    lStream.close();
    rs3.close();
    stmt3.close();
}
 
Example 2
Source Project: gemfirexd-oss   File: LobStreamsTest.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Tests the ClobWriter.write(String str, int off, int len) method
 **/
public void testClobCharacterWrite3ParamString() throws Exception
{
    PreparedStatement stmt3 = prepareStatement(
        "SELECT c FROM testBlobX1 WHERE a = 1");
    ResultSet rs3 = stmt3.executeQuery();
    rs3.next();
    Clob clob = rs3.getClob(1);
    assertTrue("FAIL -- clob is NULL", clob != null);
    Writer clobWriter = clob.setCharacterStream(1L);
    clobWriter.write(unicodeTestString, 0, unicodeTestString.length());
    clobWriter.close();

    PreparedStatement stmt4 = prepareStatement(
        "UPDATE testBlobX1 SET c = ? WHERE a = 1");
    stmt4.setClob(1,  clob);
    stmt4.executeUpdate();
    stmt4.close();

    rs3.close();
    rs3 = stmt3.executeQuery();
    assertTrue("FAIL -- clob not found", rs3.next());
    long new_length = rs3.getClob(1).length();
    assertEquals("FAIL -- wrong clob length", unicodeTestString.length(), new_length);

    // Check contents ...
    Reader lStream = rs3.getClob(1).getCharacterStream();
    assertTrue("FAIL - Clob and buffer contents do not match",
            compareClobReader2CharArray(
                unicodeTestString.toCharArray(),
                lStream));

    lStream.close();
    rs3.close();
    stmt3.close();
}
 
Example 3
Source Project: gemfirexd-oss   File: LobStreamsTest.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Tests the ClobWriter.write(String str) method
 **/
public void testClobCharacterWrite1ParamString() throws Exception
{
    PreparedStatement stmt3 = prepareStatement(
        "SELECT c FROM testBlobX1 WHERE a = 1");
    ResultSet rs3 = stmt3.executeQuery();
    rs3.next();
    Clob clob = rs3.getClob(1);
    assertTrue("FAIL -- clob is NULL", clob != null);
    Writer clobWriter = clob.setCharacterStream(1L);
    clobWriter.write(unicodeTestString);
    clobWriter.close();

    PreparedStatement stmt4 = prepareStatement(
        "UPDATE testBlobX1 SET c = ? WHERE a = 1");
    stmt4.setClob(1,  clob);
    stmt4.executeUpdate();
    stmt4.close();

    rs3.close();
    rs3 = stmt3.executeQuery();
    assertTrue("FAIL -- clob not found", rs3.next());
    long new_length = rs3.getClob(1).length();
    assertEquals("FAIL -- wrong clob length", unicodeTestString.length(), new_length);

    // Check contents ...
    Reader lStream = rs3.getClob(1).getCharacterStream();
    assertTrue("FAIL - Clob and buffer contents do not match",
            compareClobReader2CharArray(
                unicodeTestString.toCharArray(),
                lStream));

    lStream.close();
    rs3.close();
    stmt3.close();
}
 
Example 4
Source Project: gemfirexd-oss   File: LobStreamsTest.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Tests the ClobWriter.write(int c) method
 **/
public void testClobCharacterWrite1Char() throws Exception
{
    char testchar = 'a';

    PreparedStatement stmt3 = prepareStatement(
        "SELECT c FROM testBlobX1 WHERE a = 1");
    ResultSet rs3 = stmt3.executeQuery();
    rs3.next();
    Clob clob = rs3.getClob(1);

    assertTrue ("FAIL -- clob is NULL", clob != null);
    Writer clobWriter = clob.setCharacterStream(1L);
    clobWriter.write(testchar);
    clobWriter.close();

    PreparedStatement stmt4 = prepareStatement(
        "UPDATE testBlobX1 SET c = ? WHERE a = 1");
    stmt4.setClob(1,  clob);
    stmt4.executeUpdate();
    stmt4.close();

    rs3.close();
    rs3 = stmt3.executeQuery();
    assertTrue("FAIL -- clob not found", rs3.next());
    long new_length = rs3.getClob(1).length();
    Clob fish = rs3.getClob(1);
    assertEquals("FAIL -- wrong clob length", 1, new_length);
    // Check contents ...
    Reader lStream = rs3.getClob(1).getCharacterStream();
    char clobchar = (char) lStream.read();
    assertEquals("FAIL - fetched Clob and original contents do " +
            "not match", testchar, clobchar);

    lStream.close();
    rs3.close();
    stmt3.close();
}
 
Example 5
Source Project: gemfirexd-oss   File: LobStreamsTest.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Tests the ClobWriter.write(char cbuf[], int off, int len) method
 **/
public void testClobCharacterWrite3ParamChar() throws Exception
{
    char[] testdata = unicodeTestString.toCharArray();

    PreparedStatement stmt3 = prepareStatement(
        "SELECT c FROM testBlobX1 WHERE a = 1");
    ResultSet rs3 = stmt3.executeQuery();
    rs3.next();
    Clob clob = rs3.getClob(1);
    assertTrue("FAIL -- clob is NULL", clob != null);
    Writer clobWriter = clob.setCharacterStream(1L);
    clobWriter.write(testdata, 0, testdata.length);
    clobWriter.close();

    PreparedStatement stmt4 = prepareStatement(
        "UPDATE testBlobX1 SET c = ? WHERE a = 1");
    stmt4.setClob(1,  clob);
    stmt4.executeUpdate();
    stmt4.close();

    rs3.close();
    rs3 = stmt3.executeQuery();

    assertTrue("FAIL -- clob not found", rs3.next());
    long new_length = rs3.getClob(1).length();
    assertEquals("FAIL -- wrong clob length",
            testdata.length, new_length);

    // Check contents ...
    Reader lStream = rs3.getClob(1).getCharacterStream();
    assertTrue("FAIL - Clob and buffer contents do not match",
            compareClobReader2CharArray(testdata, lStream));

    lStream.close();
    rs3.close();
    stmt3.close();
}
 
Example 6
Source Project: gemfirexd-oss   File: LobStreamsTest.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Tests the ClobWriter.write(String str, int off, int len) method
 **/
public void testClobCharacterWrite3ParamString() throws Exception
{
    PreparedStatement stmt3 = prepareStatement(
        "SELECT c FROM testBlobX1 WHERE a = 1");
    ResultSet rs3 = stmt3.executeQuery();
    rs3.next();
    Clob clob = rs3.getClob(1);
    assertTrue("FAIL -- clob is NULL", clob != null);
    Writer clobWriter = clob.setCharacterStream(1L);
    clobWriter.write(unicodeTestString, 0, unicodeTestString.length());
    clobWriter.close();

    PreparedStatement stmt4 = prepareStatement(
        "UPDATE testBlobX1 SET c = ? WHERE a = 1");
    stmt4.setClob(1,  clob);
    stmt4.executeUpdate();
    stmt4.close();

    rs3.close();
    rs3 = stmt3.executeQuery();
    assertTrue("FAIL -- clob not found", rs3.next());
    long new_length = rs3.getClob(1).length();
    assertEquals("FAIL -- wrong clob length", unicodeTestString.length(), new_length);

    // Check contents ...
    Reader lStream = rs3.getClob(1).getCharacterStream();
    assertTrue("FAIL - Clob and buffer contents do not match",
            compareClobReader2CharArray(
                unicodeTestString.toCharArray(),
                lStream));

    lStream.close();
    rs3.close();
    stmt3.close();
}
 
Example 7
Source Project: gemfirexd-oss   File: LobStreamsTest.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Tests the ClobWriter.write(String str) method
 **/
public void testClobCharacterWrite1ParamString() throws Exception
{
    PreparedStatement stmt3 = prepareStatement(
        "SELECT c FROM testBlobX1 WHERE a = 1");
    ResultSet rs3 = stmt3.executeQuery();
    rs3.next();
    Clob clob = rs3.getClob(1);
    assertTrue("FAIL -- clob is NULL", clob != null);
    Writer clobWriter = clob.setCharacterStream(1L);
    clobWriter.write(unicodeTestString);
    clobWriter.close();

    PreparedStatement stmt4 = prepareStatement(
        "UPDATE testBlobX1 SET c = ? WHERE a = 1");
    stmt4.setClob(1,  clob);
    stmt4.executeUpdate();
    stmt4.close();

    rs3.close();
    rs3 = stmt3.executeQuery();
    assertTrue("FAIL -- clob not found", rs3.next());
    long new_length = rs3.getClob(1).length();
    assertEquals("FAIL -- wrong clob length", unicodeTestString.length(), new_length);

    // Check contents ...
    Reader lStream = rs3.getClob(1).getCharacterStream();
    assertTrue("FAIL - Clob and buffer contents do not match",
            compareClobReader2CharArray(
                unicodeTestString.toCharArray(),
                lStream));

    lStream.close();
    rs3.close();
    stmt3.close();
}
 
Example 8
Source Project: gemfirexd-oss   File: LobStreamsTest.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Tests the ClobWriter.write(int c) method
 **/
public void testClobCharacterWrite1Char() throws Exception
{
    char testchar = 'a';

    PreparedStatement stmt3 = prepareStatement(
        "SELECT c FROM testBlobX1 WHERE a = 1");
    ResultSet rs3 = stmt3.executeQuery();
    rs3.next();
    Clob clob = rs3.getClob(1);

    assertTrue ("FAIL -- clob is NULL", clob != null);
    Writer clobWriter = clob.setCharacterStream(1L);
    clobWriter.write(testchar);
    clobWriter.close();

    PreparedStatement stmt4 = prepareStatement(
        "UPDATE testBlobX1 SET c = ? WHERE a = 1");
    stmt4.setClob(1,  clob);
    stmt4.executeUpdate();
    stmt4.close();

    rs3.close();
    rs3 = stmt3.executeQuery();
    assertTrue("FAIL -- clob not found", rs3.next());
    long new_length = rs3.getClob(1).length();
    Clob fish = rs3.getClob(1);
    assertEquals("FAIL -- wrong clob length", 1, new_length);
    // Check contents ...
    Reader lStream = rs3.getClob(1).getCharacterStream();
    char clobchar = (char) lStream.read();
    assertEquals("FAIL - fetched Clob and original contents do " +
            "not match", testchar, clobchar);

    lStream.close();
    rs3.close();
    stmt3.close();
}
 
Example 9
/**
 * Tests the ClobWriter.write(char cbuf[], int off, int len) method
 **/
public void testClobCharacterWrite3ParamChar() throws Exception
{
    char[] testdata = unicodeTestString.toCharArray();

    PreparedStatement stmt3 = prepareStatement(
        "SELECT c FROM testBlobX1 WHERE a = 1");
    ResultSet rs3 = stmt3.executeQuery();
    rs3.next();
    Clob clob = rs3.getClob(1);
    assertTrue("FAIL -- clob is NULL", clob != null);
    Writer clobWriter = clob.setCharacterStream(1L);
    clobWriter.write(testdata, 0, testdata.length);
    clobWriter.close();

    PreparedStatement stmt4 = prepareStatement(
        "UPDATE testBlobX1 SET c = ? WHERE a = 1");
    stmt4.setClob(1,  clob);
    stmt4.executeUpdate();
    stmt4.close();

    rs3.close();
    rs3 = stmt3.executeQuery();

    assertTrue("FAIL -- clob not found", rs3.next());
    clob = rs3.getClob(1);
    long new_length = clob.length();
    assertEquals("FAIL -- wrong clob length",
            testdata.length, new_length);

    // Check contents ...
    Reader lStream = clob.getCharacterStream();
    assertTrue("FAIL - Clob and buffer contents do not match",
            compareClobReader2CharArray(testdata, lStream));

    lStream.close();
    rs3.close();
    stmt3.close();
}
 
Example 10
/**
 * Tests the ClobWriter.write(String str, int off, int len) method
 **/
public void testClobCharacterWrite3ParamString() throws Exception
{
    PreparedStatement stmt3 = prepareStatement(
        "SELECT c FROM testBlobX1 WHERE a = 1");
    ResultSet rs3 = stmt3.executeQuery();
    rs3.next();
    Clob clob = rs3.getClob(1);
    assertTrue("FAIL -- clob is NULL", clob != null);
    Writer clobWriter = clob.setCharacterStream(1L);
    clobWriter.write(unicodeTestString, 0, unicodeTestString.length());
    clobWriter.close();

    PreparedStatement stmt4 = prepareStatement(
        "UPDATE testBlobX1 SET c = ? WHERE a = 1");
    stmt4.setClob(1,  clob);
    stmt4.executeUpdate();
    stmt4.close();

    rs3.close();
    rs3 = stmt3.executeQuery();
    assertTrue("FAIL -- clob not found", rs3.next());

    clob = rs3.getClob(1);
    long new_length = clob.length();
    assertEquals("FAIL -- wrong clob length", unicodeTestString.length(), new_length);

    // Check contents ...
    Reader lStream = clob.getCharacterStream();
    assertTrue("FAIL - Clob and buffer contents do not match",
            compareClobReader2CharArray(
                unicodeTestString.toCharArray(),
                lStream));

    lStream.close();
    rs3.close();
    stmt3.close();
}
 
Example 11
/**
 * Tests the ClobWriter.write(String str) method
 **/
public void testClobCharacterWrite1ParamString() throws Exception
{
    PreparedStatement stmt3 = prepareStatement(
        "SELECT c FROM testBlobX1 WHERE a = 1");
    ResultSet rs3 = stmt3.executeQuery();
    rs3.next();
    Clob clob = rs3.getClob(1);
    assertTrue("FAIL -- clob is NULL", clob != null);
    Writer clobWriter = clob.setCharacterStream(1L);
    clobWriter.write(unicodeTestString);
    clobWriter.close();

    PreparedStatement stmt4 = prepareStatement(
        "UPDATE testBlobX1 SET c = ? WHERE a = 1");
    stmt4.setClob(1,  clob);
    stmt4.executeUpdate();
    stmt4.close();

    rs3.close();
    rs3 = stmt3.executeQuery();
    assertTrue("FAIL -- clob not found", rs3.next());

    clob = rs3.getClob(1);
    long new_length = clob.length();
    assertEquals("FAIL -- wrong clob length", unicodeTestString.length(), new_length);

    // Check contents ...
    Reader lStream = clob.getCharacterStream();
    assertTrue("FAIL - Clob and buffer contents do not match",
            compareClobReader2CharArray(
                unicodeTestString.toCharArray(),
                lStream));

    lStream.close();
    rs3.close();
    stmt3.close();
}
 
Example 12
/**
 * Tests the ClobWriter.write(int c) method
 **/
public void testClobCharacterWrite1Char() throws Exception
{
    char testchar = 'a';

    PreparedStatement stmt3 = prepareStatement(
        "SELECT c FROM testBlobX1 WHERE a = 1");
    ResultSet rs3 = stmt3.executeQuery();
    rs3.next();
    Clob clob = rs3.getClob(1);

    assertTrue ("FAIL -- clob is NULL", clob != null);
    Writer clobWriter = clob.setCharacterStream(1L);
    clobWriter.write(testchar);
    clobWriter.close();

    PreparedStatement stmt4 = prepareStatement(
        "UPDATE testBlobX1 SET c = ? WHERE a = 1");
    stmt4.setClob(1,  clob);
    stmt4.executeUpdate();
    stmt4.close();

    rs3.close();
    rs3 = stmt3.executeQuery();
    assertTrue("FAIL -- clob not found", rs3.next());

    clob = rs3.getClob(1);
    long new_length = clob.length();
    assertEquals("FAIL -- wrong clob length", 1, new_length);
    // Check contents ...
    Reader lStream = clob.getCharacterStream();
    char clobchar = (char) lStream.read();
    assertEquals("FAIL - fetched Clob and original contents do " +
            "not match", testchar, clobchar);

    lStream.close();
    rs3.close();
    stmt3.close();
}
 
Example 13
/**
 * Tests updates on reader.
 */
public void testUpdateableReader () throws Exception {
    getConnection().setAutoCommit (false);
    PreparedStatement ps = prepareStatement ("insert into updateClob " +
            "(id , data) values (? ,?)");
    ps.setInt (1, 1);
    StringBuilder sb = new StringBuilder ();
    String base = "SampleSampleSample";
    for (int i = 0; i < 100; i++) {
        sb.append (base);
    }
    ps.setCharacterStream (2, new StringReader (sb.toString()),
                                        sb.length());
    ps.execute();
    ps.close();
    Statement stmt = createStatement ();
    ResultSet rs = stmt.executeQuery("select data from " +
            "updateClob where id = 1");
    rs.next();
    Clob clob = rs.getClob (1);
    rs.close();
    stmt.close();
    assertEquals (sb.length(), clob.length());
    Reader r = clob.getCharacterStream();
    char [] clobData = new char [sb.length()];
    r.read (clobData);
    assertEquals ("mismatch from inserted string",
                        String.valueOf (clobData), sb.toString());
    r.close();
    //update before gettting the reader
    clob.setString (50, dummy);
    r = clob.getCharacterStream();
    r.skip (49);
    char [] newChars = new char [dummy.length()];
    r.read (newChars);
    assertEquals ("update not reflected", dummy,
                                String.valueOf (newChars));
    //update again and see if stream is refreshed
    clob.setString (75, dummy);
    r.skip (75 - 50 - dummy.length());
    char [] testChars = new char [dummy.length()];
    r.read (testChars);
    assertEquals ("update not reflected", dummy,
                                String.valueOf (newChars));
    r.close();
    //try inserting some unicode string
    String unicodeStr = getUnicodeString();
    clob.setString (50, unicodeStr);
    char [] utf16Chars = new char [unicodeStr.length()];
    r = clob.getCharacterStream();
    r.skip(49);
    r.read(utf16Chars);
    assertEquals ("update not reflected",  unicodeStr,
                                String.valueOf (utf16Chars));
    r.close();
    Writer w = clob.setCharacterStream (1);
    //write enough data to switch the data to file
    r = clob.getCharacterStream ();
    for (int i = 0; i < 10000; i++) {
        w.write (dummy);
    }
    w.close();
    clob.setString (500, unicodeStr);
    r.skip (499);
    char [] unicodeChars = new char [unicodeStr.length()];
    r.read (unicodeChars);
    assertEquals ("update not reflected",  unicodeStr,
                                String.valueOf (unicodeChars));
}
 
Example 14
/**
 * Tests updates on reader.
 */
public void testUpdateableReader () throws Exception {
    getConnection().setAutoCommit (false);
    PreparedStatement ps = prepareStatement ("insert into updateClob " +
            "(id , data) values (? ,?)");
    ps.setInt (1, 1);
    StringBuilder sb = new StringBuilder ();
    String base = "SampleSampleSample";
    for (int i = 0; i < 100; i++) {
        sb.append (base);
    }
    ps.setCharacterStream (2, new StringReader (sb.toString()),
                                        sb.length());
    ps.execute();
    ps.close();
    Statement stmt = createStatement ();
    ResultSet rs = stmt.executeQuery("select data from " +
            "updateClob where id = 1");
    rs.next();
    Clob clob = rs.getClob (1);
    rs.close();
    stmt.close();
    assertEquals (sb.length(), clob.length());
    Reader r = clob.getCharacterStream();
    char [] clobData = new char [sb.length()];
    r.read (clobData);
    assertEquals ("mismatch from inserted string",
                        String.valueOf (clobData), sb.toString());
    r.close();
    //update before gettting the reader
    clob.setString (50, dummy);
    r = clob.getCharacterStream();
    r.skip (49);
    char [] newChars = new char [dummy.length()];
    r.read (newChars);
    assertEquals ("update not reflected", dummy,
                                String.valueOf (newChars));
    //update again and see if stream is refreshed
    clob.setString (75, dummy);
    r.skip (75 - 50 - dummy.length());
    char [] testChars = new char [dummy.length()];
    r.read (testChars);
    assertEquals ("update not reflected", dummy,
                                String.valueOf (newChars));
    r.close();
    //try inserting some unicode string
    String unicodeStr = getUnicodeString();
    clob.setString (50, unicodeStr);
    char [] utf16Chars = new char [unicodeStr.length()];
    r = clob.getCharacterStream();
    r.skip(49);
    r.read(utf16Chars);
    assertEquals ("update not reflected",  unicodeStr,
                                String.valueOf (utf16Chars));
    r.close();
    Writer w = clob.setCharacterStream (1);
    //write enough data to switch the data to file
    r = clob.getCharacterStream ();
    for (int i = 0; i < 10000; i++) {
        w.write (dummy);
    }
    w.close();
    clob.setString (500, unicodeStr);
    r.skip (499);
    char [] unicodeChars = new char [unicodeStr.length()];
    r.read (unicodeChars);
    assertEquals ("update not reflected",  unicodeStr,
                                String.valueOf (unicodeChars));
}
 
Example 15
/**
 * Tests updates on reader.
 */
public void testUpdateableReader () throws Exception {
    getConnection().setAutoCommit (false);
    PreparedStatement ps = prepareStatement ("insert into updateClob " +
            "(id , data) values (? ,?)");
    ps.setInt (1, 1);
    StringBuffer sb = new StringBuffer ();
    String base = "SampleSampleSample";
    for (int i = 0; i < 100; i++) {
        sb.append (base);
    }
    ps.setCharacterStream (2, new StringReader (sb.toString()),
                                        sb.length());
    ps.execute();
    ps.close();
    Statement stmt = createStatement ();
    ResultSet rs = stmt.executeQuery("select data from " +
            "updateClob where id = 1");
    rs.next();
    Clob clob = rs.getClob (1);
    rs.close();
    stmt.close();
    assertEquals (sb.length(), clob.length());
    Reader r = clob.getCharacterStream();
    char [] clobData = new char [sb.length()];
    r.read (clobData);
    assertEquals ("mismatch from inserted string",
                        String.valueOf (clobData), sb.toString());
    r.close();
    //update before gettting the reader
    clob.setString (50, dummy);
    r = clob.getCharacterStream();
    r.skip (49);
    char [] newChars = new char [dummy.length()];
    r.read (newChars);
    assertEquals ("update not reflected", dummy,
                                String.valueOf (newChars));
    //update again and see if stream is refreshed
    clob.setString (75, dummy);
    r.skip (75 - 50 - dummy.length());
    char [] testChars = new char [dummy.length()];
    r.read (testChars);
    assertEquals ("update not reflected", dummy,
                                String.valueOf (newChars));
    r.close();
    //try inserting some unicode string
    String unicodeStr = getUnicodeString();
    clob.setString (50, unicodeStr);
    char [] utf16Chars = new char [unicodeStr.length()];
    r = clob.getCharacterStream();
    r.skip(49);
    r.read(utf16Chars);
    assertEquals ("update not reflected",  unicodeStr,
                                String.valueOf (utf16Chars));
    r.close();
    Writer w = clob.setCharacterStream (1);
    //write enough data to switch the data to file
    r = clob.getCharacterStream ();
    for (int i = 0; i < 10000; i++) {
        w.write (dummy);
    }
    w.close();
    clob.setString (500, unicodeStr);
    r.skip (499);
    char [] unicodeChars = new char [unicodeStr.length()];
    r.read (unicodeChars);
    assertEquals ("update not reflected",  unicodeStr,
                                String.valueOf (unicodeChars));
}