What is ResultSetMetaData?
- ResultSetMetaData is a class which provides information about a result set that is returned by an executeQuery() method. JDBC details interrogation can be done by using ResultSetMetaData. It includes the information about the names of the columns, number of columns, data type they contain etc. Some of the methods are:
- getColumnClassName(), getColumnName(), getColumnType(), getColumnTypeName(), getPrecision(), getTableName(), isReadOnly(), isWritable() etc.
- ResultSetMetaData Interface holds information about the columns in a ResultSet.
- ResultSetMetaData is an object that gets information about the types and properties of the columns in a ResultSet object.
Example: ResultSet resultSet1 = statement1.executeQuery("SELECT a, b, c FROM TABLE2");
ResultSetMetaData rsmd = rs.getMetaData();