public static List < String > getFieldNames ( DatabaseMetaData meta , String table ) throws SQLException { List < String > fieldNameList = new ArrayList < String > ( ) ; TableLocation location = TableLocation . parse ( table ) ; ResultSet rs = meta . getColumns ( location . getCatalog ( null ) , location . getSchema ( null ) , location . getTable ( ) , null ) ; try { while ( rs . next ( ) ) { fieldNameList . add ( rs . getString ( "COLUMN_NAME" ) ) ; } } finally { rs . close ( ) ; } return fieldNameList ; }
Returns the list of all the field name of a table .