public Collection < String > listColumns ( String table ) throws SQLException { Collection < String > result = new ArrayList < String > ( ) ; DatabaseMetaData dbm = connection . getMetaData ( ) ; ResultSet rs = dbm . getColumns ( null , null , table , null ) ; while ( rs . next ( ) ) { result . add ( rs . getString ( "COLUMN_NAME" ) ) ; } return result ; }
Get a list of all of the columns on a table .