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

	    model.setColumnIdentifiers(columnLabels);

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