The ResultSetMetaData interface creates an object that can be used to find out about the types and properties of the columns in a ResultSet.
First we need to understand what is meta data ?
The meta data describes data about data. It means we dig more information about data. Like finding total of given data, count .etc
Most useful methods in ResultSetMetaData interface| Method Name | Method Description |
public int getColumnCount()throws SQLException | It returns the total number of columns in the ResultSet object. |
public String getColumnName(int index)throws SQLException | It returns the column name of the specified column index. |
public String getColumnTypeName(int index)throws SQLException | It returns the column type name for the specified index. |
public String getTableName(int index)throws SQLException | It returns the table name for the specified column index. |
The following example describes , how to list meta data information about EMPLOYEE table.
OUTPUT:
Employee Table details Total Columns : 2 Column Label Cloumn Name ColumnType id id 4 name name 12
0 comments :
Post a Comment