private DefaultTableModel resultSetToTableModel(DefaultTableModel model, CachedRowSetImpl rowSet) throws SQLException {
		ResultSetMetaData rsMetaData = rowSet.getMetaData();
		if(model == null){
			model = new DefaultTableModel();
		}
		String columnLabels[] = new String[rsMetaData.getColumnCount() + 1];
		columnLabels[0] = "Rank";
		for(int i = 1;i < columnLabels.length; i++) {
			columnLabels[i] = rsMetaData.getColumnLabel(i);
		}

	    model.setColumnIdentifiers(columnLabels);
	    model.setRowCount(0);
	    int rank = 1;
	    while(rowSet.next()) {
	        Object data[] = new Object[columnLabels.length + 1];
	        data[0] = rank;
	        rank++;
	        for(int i = 1; i < data.length - 1; i++) {
	             data[i] = rowSet.getObject(i);
	        }
	        model.addRow(data);
	    }
	    return model;
	}