Java Code Examples for java.sql.ResultSet#getNClob()

The following examples show how to use java.sql.ResultSet#getNClob() . 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 want to check out the right sidebar which shows the related API usage.
Example 1
@Test
public void testSetNClob() throws Exception {

  createTable("testSetNClob", "id int not null primary key, strm text", "CHARSET utf8");
  PreparedStatement stmt =
      sharedConnection.prepareStatement("insert into testSetNClob (id, strm) values (?,?)");
  NClob nclob = sharedConnection.createNClob();
  OutputStream stream = nclob.setAsciiStream(1);
  byte[] bytes = "hello".getBytes();
  stream.write(bytes);

  stmt.setInt(1, 1);
  stmt.setNClob(2, nclob);
  stmt.execute();

  ResultSet rs = sharedConnection.createStatement().executeQuery("select * from testSetNClob");
  assertTrue(rs.next());
  assertTrue(rs.getObject(2) instanceof String);
  assertTrue(rs.getString(2).equals("hello"));
  NClob resultNClob = rs.getNClob(2);
  assertNotNull(resultNClob);
  assertEquals(5, resultNClob.getAsciiStream().available());
}
 
Example 2
@Test(expected = SQLFeatureNotSupportedException.class)
public void assertGetNClobForColumnIndex() throws SQLException {
    for (ResultSet each : resultSets) {
        each.getNClob(1);
    }
}
 
Example 3
@Test(expected = SQLFeatureNotSupportedException.class)
public void assertGetNClobForColumnLabel() throws SQLException {
    for (ResultSet each : resultSets) {
        each.getNClob("label");
    }
}
 
Example 4
public Object getNClob(ResultSet r) throws SQLException {
  return r.getNClob(ordinal);
}
 
Example 5
public NClob getNClob(ResultSet r) throws SQLException {
  return r.getNClob(label);
}
 
Example 6
@Test(expected = SQLFeatureNotSupportedException.class)
public void assertGetNClobForColumnIndex() throws SQLException {
    for (ResultSet each : resultSets) {
        each.getNClob(1);
    }
}
 
Example 7
@Test(expected = SQLFeatureNotSupportedException.class)
public void assertGetNClobForColumnLabel() throws SQLException {
    for (ResultSet each : resultSets) {
        each.getNClob("label");
    }
}
 
Example 8
Source Project: SimpleFlatMapper   File: NClobResultSetGetter.java    License: MIT License 4 votes vote down vote up
public NClob get(final ResultSet target) throws SQLException {
	return target.getNClob(column);
}