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

This code example shows how to use the following methods:next, execute, setCommand, setPassword, setUrl
        try { 
            // Load the JDBC driver 
            Class.forName("com.mysql.jdbc.Driver"); 
            System.out.println("Driver loaded"); 
            rowSet = new JdbcRowSetImpl(); 
            rowSet.setUrl("jdbc:mysql://localhost/javabook"); 
            rowSet.setUsername("scott"); 
            rowSet.setPassword("tiger"); 
            String sql; 
            sql = "SELECT * FROM Poll"; 
            rowSet.setCommand(sql); 
            rowSet.execute(); 
            rowSet.next(); 
        } catch(Exception ex) { 
            ex.printStackTrace(); 
        } 
    } 
     
    private Boolean setIsYes(String ans) { 
        // Notes from the board on Monday 12/3/2012 
6
CodeRank
This code example shows how to use the following methods:findColumn, getString
        departureTime = new DateTime(scanner.nextLine());
        arrivalTime = new DateTime(scanner.nextLine());
    } 
 
    public BadFlightClass(RowSet rowSet) throws SQLException {
        origin = rowSet.getString(rowSet.findColumn("origin"));
        destination = rowSet.getString(rowSet.findColumn("destination"));
        departureTime = new DateTime(rowSet.getString(rowSet.findColumn("departureTime")));
        arrivalTime = new DateTime(rowSet.getString(rowSet.findColumn("arrivalTime")));
    } 
 
    public String getOrigin() {
        return origin;
    } 
 
    public void setOrigin(String origin) {
        this.origin = origin;
    } 
 
    public String getDestination() {
6
CodeRank
This code example shows how to use the following methods:setMaxRows, populate, setPageSize
                    t);
        } 
 
        if (resultSet != null) {
            if (limit > -1) {
                result.setPageSize(limit);
                result.setMaxRows(limit);
            } 
 
            result.populate(resultSet, start < 0 ? 1 : start + 1);
        } 
 
        return result;
    } 
 
    /** JdbcResult instance that gives access to the resultSet. */ 
    private volatile JdbcResult jdbcResult;
 
    /** Inner WebRowSet Instance. */ 
    private volatile WebRowSet webRowSet;
6
CodeRank
This code example shows how to use the following methods:absolute, getObject, getMaxRows
	} 
    
	public int getRowCount() { 
		int count = 0;
		try { 
			count = rowSet.getMaxRows();
		} catch (Exception e) {
			e.printStackTrace();
		} 
		return count;
	} 
    
	protected Vector getKeyForItem(int rowIndex) {
		return getKeyForItem(rowIndex,true);
	} 
    
	protected Vector getKeyForItem(int rowIndex,boolean includeNotKeyColumn) {
		Vector<Object> key = new Vector<Object>();
		for(int i=0;i<getColumnCount();i++) {
			if(!includeNotKeyColumn) {

5
CodeRank
This code example shows how to use the following methods:absolute, getObject, getMaxRows
		return count;
	} 
    
	public int getRowCount() { 
		try { 
			return rowSet.getMaxRows();
		} catch (Exception ex) {
			logger.severe(ex.getMessage());
			return 0; 
		} 
	} 
    
	protected Vector getKeyForItem(int rowIndex) {
		return getKeyForItem(rowIndex,true);
	} 
    
	protected Vector getKeyForItem(int rowIndex,boolean includeNotKeyColumn) {
		Vector<Object> key = new Vector<Object>();
		for(int i=0;i<getColumnCount();i++) {
			if(!includeNotKeyColumn) {

5
CodeRank
This code example shows how to use the following methods:setFetchDirection, setCommand
 
        // the default is TYPE_SCROLL_INSENSITIVE and CONCUR_READ_ONLY 
        // which is good 
        cachedResults = new CachedRowSetImpl();
 
        cachedResults.setCommand(SQL);
        cachedResults.setFetchDirection(ResultSet.FETCH_UNKNOWN);
    // the BL list class will set the parameters of the query 
    } 
 
    protected void execute() throws SQLException {
        // the connection will be closed by the RowSet as soon as it 
        // finished executing the command 
        conn = ((DataSource) Context.getBean(Context.Name.DATA_SOURCE)).getConnection();
 
        cachedResults.execute(conn);
    } 
} 
5
CodeRank
This code example shows how to use the following methods:close
	 * @param conn 
	 * @throws SQLException 
	 */ 
	public static void closeJdbcResource(RowSet rowSet,Statement stmt, Connection conn) throws SQLException { 
		if (rowSet != null) { 
			rowSet.close();
		} 
		if (stmt != null) { 
			stmt.close();
		} 
		if (conn != null) {
			conn.close();
		} 
	} 
} 
5
CodeRank
This code example shows how to use the following methods:getUsername
/*     */   private int columnCount;
/*     */  
/*     */   private String getSchemaName(RowSet paramRowSet)
/*     */     throws SQLException 
/*     */   { 
/* 137 */     return paramRowSet.getUsername();
/*     */   } 
/*     */  
/*     */   private String getTableName(RowSet paramRowSet)
/*     */     throws SQLException 
/*     */   { 
/* 163 */     String str1 = ((OracleCachedRowSet)paramRowSet).getTableName();
/* 164 */     if (str1 != null) {
/* 165 */       return str1;
/*     */     } 
/* 167 */     String str2 = paramRowSet.getCommand().toUpperCase();
/*     */  
/* 184 */     int i = str2.indexOf(" FROM ");
/*     */  
/* 201 */     if (i == -1) {
3
CodeRank
This code example shows how to use the following methods:execute
	@Test(expected = NetworkReactiveAuditException.class)
	public void execute() 
			throws SQLException
	{ 
		TestTools.strict.commit(); 
		x.execute();
	} 
 
} 
3
CodeRank
This code example shows how to use the following methods:close
public class DatabaseUtil { 
 
	public static void close(RowSet rs) {
		try { 
			if (rs != null) {
				rs.close();
			} 
		} catch (Exception e) {
			// ignore 
			TigerstripeRuntime.logErrorMessage("Exception detected", e);
		} 
	} 
 
	public static void close(ResultSet rs) {
		try { 
			if (rs != null) {
				rs.close();
			} 
		} catch (Exception e) {
			// ignore 
4
CodeRank
See Code Examples for Java 8 RowSet Methods: