Java 8 NClob - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 NClob class.

This code example shows how to use the following methods:getNClob
		return stat.getNCharacterStream(parameterName);
	} 
 
	@Override 
	public NClob getNClob(int parameterIndex) throws SQLException {
		return stat.getNClob(parameterIndex);
	} 
 
	@Override 
	public NClob getNClob(String parameterName) throws SQLException {
		return stat.getNClob(parameterName);
	} 
 
	@Override 
	public String getNString(int parameterIndex) throws SQLException {
		return stat.getNString(parameterIndex);
	} 
 
	@Override 
	public String getNString(String parameterName) throws SQLException {
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getNClob
    } 
     
    public void testGetNClobIntNotImplemented() 
        throws SQLException {
        try { 
            cStmt.getNClob(1);
            fail("CallableStatement.getNClob(int) should not be implemented"); 
        } catch (SQLFeatureNotSupportedException sfnse) {
            // We are fine, do nothing. 
        } 
    } 
     
    public void testGetNClobStringNotImplemented()  
        throws SQLException {
        try { 
            cStmt.getNClob("some-parameter-name");
            fail("CallableStatement.getNClob(String) " + 
                 "should not be implemented"); 
        } catch (SQLFeatureNotSupportedException sfnse) {
            // We are fine, do nothing. 
3
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getNClob
    } 
 
    @Override 
    protected NClob doGetValue(CallableStatement callableStatement, int index)
            throws SQLException {
        return callableStatement.getNClob(index);
    } 
 
    @Override 
    protected String doConvertToLogFormat(NClob value) {
        return String.valueOf(value);
    } 
 
} 
3
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getCharacterStream, length
	 */ 
	static void setNClob(PreparedStatement pstmt, int parameterIndex, NClob value) throws SQLException {
		if (value == null) {
			pstmt.setNull(parameterIndex, java.sql.Types.NCLOB);
	    } else { 
	    	pstmt.setNCharacterStream(parameterIndex, value.getCharacterStream(), value.length());
	    } 
	} 
 
	static void setNClob(PreparedStatement pstmt, int parameterIndex, Reader reader) throws SQLException {
		pstmt.setNCharacterStream(parameterIndex, reader);
	} 
 
	/** 
	 * JDBC 4.0 Set a NCLOB parameter. 
	 *  
	 * @param parameterIndex 
	 *            the first parameter is 1, the second is 2, ... 
	 * @param reader 
	 *            the java reader which contains the UNICODE data 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getNClob
   * {@inheritDoc} 
   */ 
  @Override 
  public NClob getNClob(int parameterIndex) throws SQLException {
    try { 
      return delegator.getNClob(parameterIndex);
    } 
    catch (SQLException se) {
      owner.fireStatementError(this, se);
      throw se;
    } 
  } 
 
  /** 
   * {@inheritDoc} 
   */ 
  @Override 
  public NClob getNClob(String parameterName) throws SQLException {
    try { 
      return delegator.getNClob(parameterName);
1
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getCharacterStream, length
	 */ 
	static void setNClob(PreparedStatement pstmt, int parameterIndex, NClob value) throws SQLException {
		if (value == null) {
			pstmt.setNull(parameterIndex, java.sql.Types.NCLOB);
	    } else { 
	    	pstmt.setNCharacterStream(parameterIndex, value.getCharacterStream(), value.length());
	    } 
	} 
 
	static void setNClob(PreparedStatement pstmt, int parameterIndex, Reader reader) throws SQLException {
		pstmt.setNCharacterStream(parameterIndex, reader);
	} 
 
	/** 
	 * JDBC 4.0 Set a NCLOB parameter. 
	 *  
	 * @param parameterIndex 
	 *            the first parameter is 1, the second is 2, ... 
	 * @param reader 
	 *            the java reader which contains the UNICODE data 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getCharacterStream, length
	 */ 
	static void setNClob(PreparedStatement pstmt, int parameterIndex, NClob value) throws SQLException {
		if (value == null) {
			pstmt.setNull(parameterIndex, java.sql.Types.NCLOB);
	    } else { 
	    	pstmt.setNCharacterStream(parameterIndex, value.getCharacterStream(), value.length());
	    } 
	} 
 
	static void setNClob(PreparedStatement pstmt, int parameterIndex, Reader reader) throws SQLException {
		pstmt.setNCharacterStream(parameterIndex, reader);
	} 
 
	/** 
	 * JDBC 4.0 Set a NCLOB parameter. 
	 *  
	 * @param parameterIndex 
	 *            the first parameter is 1, the second is 2, ... 
	 * @param reader 
	 *            the java reader which contains the UNICODE data 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setString
	    pstmt2.execute();
	    Statement stmt2 = conn2.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
	    ResultSet rs3 = stmt2.executeQuery("SELECT c1, c2 FROM testUpdateNChlob");
	    rs3.next();
	    NClob nClob4 = conn2.createNClob();
	    nClob4.setString(1, "bbb");
	    try { 
	        rs3.updateNClob("c2", nClob4); // field's charset isn't utf8
	        fail(); 
	    } catch (SQLException ex) {
	        assertEquals("Can not call updateNClob() when field's character set isn't UTF-8", 
	                ex.getMessage());
	    } 
	    rs3.close();
	    pstmt2.close();
	    stmt2.close();
	    conn2.close();  
	} 
 
	/** 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setString
	    pstmt1.execute();
	    Statement stmt1 = conn1.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
	    ResultSet rs1 = stmt1.executeQuery("SELECT c1, c2 FROM testUpdateNChlob");
	    rs1.next();
	    NClob nClob2 = conn1.createNClob();
	    nClob2.setString(1, "bbb");
	    rs1.updateNClob("c2", nClob2);
	    rs1.updateRow();
	    rs1.moveToInsertRow();
	    rs1.updateString("c1", "2");
	    NClob nClob3 = conn1.createNClob();
	    nClob3.setString(1, "ccc");
	    rs1.updateNClob("c2", nClob3);
	    rs1.insertRow();
	    ResultSet rs2 = stmt1.executeQuery("SELECT c1, c2 FROM testUpdateNChlob");
	    rs2.next();
	    assertEquals("1", rs2.getString("c1"));
	    assertEquals("bbb", rs2.getNString("c2"));
	    rs2.next();
	    assertEquals("2", rs2.getString("c1"));
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setString
	    pstmt1.execute();
	    Statement stmt1 = conn1.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
	    ResultSet rs1 = stmt1.executeQuery("SELECT c1, c2 FROM testUpdateNChlob");
	    rs1.next();
	    NClob nClob2 = conn1.createNClob();
	    nClob2.setString(1, "bbb");
	    rs1.updateNClob("c2", nClob2);
	    rs1.updateRow();
	    rs1.moveToInsertRow();
	    rs1.updateString("c1", "2");
	    NClob nClob3 = conn1.createNClob();
	    nClob3.setString(1, "ccc");
	    rs1.updateNClob("c2", nClob3);
	    rs1.insertRow();
	    ResultSet rs2 = stmt1.executeQuery("SELECT c1, c2 FROM testUpdateNChlob");
	    rs2.next();
	    assertEquals("1", rs2.getString("c1"));
	    assertEquals("bbb", rs2.getNString("c2"));
	    rs2.next();
	    assertEquals("2", rs2.getString("c1"));
4
CodeRank
Experience pair programming with AI  Get Codota for Java
See Code Examples for Java 8 NClob Methods: