Java 8 CallableStatement - 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 CallableStatement class.

This code example shows how to use the following methods: getInt, wasNull
    } 
  } 
 
  @Override 
  public E getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
    int i = cs.getInt(columnIndex);
    if (cs.wasNull()) {
      return null; 
    } else { 
      try { 
        return enums[i];
      } catch (Exception ex) {
        throw new IllegalArgumentException("Cannot convert " + i + " to " + type.getSimpleName() + " by ordinal value.", ex);
      } 
    } 
  } 
   
} 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: registerOutParameter, executeUpdate, setString
	 
		String stmt =  "call db2gse.ST_unregister_spatial_column(?,?,?,?,?)";
	 
		String s = "{" + stmt + "}";
		CallableStatement ps = con.prepareCall(s);
		ps.setString(1, quote(schemaName));
		ps.setString(2, quote(tableName));
		ps.setString(3, quote(columnName));
		ps.registerOutParameter(4, Types.INTEGER);
		ps.registerOutParameter(5, Types.CHAR);
		ps.executeUpdate();
		//DB2TestSetup.LOGGER.log(Level.INFO,ps.getInt(4) + "|" + ps.getString(5)); 
		 
		 
	} 
 
	static { 
		PARAMETER_MARKES = new HashMap<Class,String>();
		PARAMETER_MARKES.put(Point.class, "DB2GSE.ST_PointFromWKB(cast (? as BLOB(2G)),{0})");
		PARAMETER_MARKES.put(LineString.class, "DB2GSE.ST_LineFromWKB(cast (? as BLOB(2G)),{0})");
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getInt, getString, registerOutParameter, executeUpdate, setNull
	static protected void enableDB(Connection con) {
		if (ISENABLED) return;
	    try { 
	        CallableStatement s = con.prepareCall(
	                " {call db2gse.ST_enable_db(?,?,?) }"); 
	        s.registerOutParameter(2, Types.INTEGER);
	        s.registerOutParameter(3, Types.CHAR);
	        s.setNull(1, Types.CHAR);
	        s.executeUpdate();
	        DB2TestSetup.LOGGER.log(Level.INFO,s.getInt(2) + "|" + s.getString(3));
	    } catch (SQLException e) {
	        Assert.fail(e.getMessage());
	        DB2TestSetup.LOGGER.log(Level.SEVERE,e.getMessage(),e);
	    } 
	    ISENABLED=true;
	} 
	 
} 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getBoolean, getDouble, getFloat, getInt, getLong
	public Object get(Class<?> type, CallableStatement cs, int index) throws SQLException {
		Object value = null; 
		boolean wasNullCheck = false;
 
		if(type == String.class){
			value = cs.getString(index);
 
		} else if(type == Integer.class || type == Integer.TYPE){
			value = cs.getInt(index);
			wasNullCheck = true;
 
		} else if(type == Long.class  || type == Long.TYPE){
			value = cs.getLong(index);
			wasNullCheck = true;
 
		} else if(type == Short.class  || type == Short.TYPE){
			value = cs.getShort(index);
			wasNullCheck = true;
 
		} else if(type == Double.class  || type == Double.TYPE){

6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getInt, registerOutParameter, execute, setString
		int newSeq = 0;
		Connection conn = null;
		try {  
			conn = dataSource.getConnection();
			CallableStatement cstmt = conn.prepareCall("{? = call dbo.p_get_next_sequence(?)}");
	    	cstmt.registerOutParameter(1, Types.INTEGER);
	        cstmt.setString(2, sequenceName);
	        cstmt.execute();
	        newSeq = cstmt.getInt(1);
		} catch (SQLException sqlEx) { 
			log.error("SQLServerSequenceDAO:generateSequence"+sqlEx.getMessage(),sqlEx);
			throw new I2B2DAOException("SQLServerSequenceDAO:generateSequence"+sqlEx.getMessage(),sqlEx);
		} finally {  
			if (conn !=null) {
				try { 
					conn.close();
				} catch (SQLException e) {
					; 
				} 
			} 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
See Code Examples for Java 8 CallableStatement Methods: