ResultSetMetaData and DatabaseMetaData are JDBC interfaces used to obtain information about database results and the database itself. ResultSetMetaData provides information about the columns returned by a query, such as column names, data types, and number of columns. DatabaseMetaData provides information about the database, JDBC driver, tables, supported features, and database capabilities. Both are useful when developing applications that need to inspect database structures dynamically without knowing all details in advance.
Methods of ResultSetMetaData
| Method Signature and Short Description |
|---|
|
Returns the number of columns in the |
|
Returns the name of the specified column. |
|
Returns the suggested label for the specified column. |
|
Returns the SQL type of the specified column. |
|
Returns the database-specific type name of the specified column. |
|
Returns the normal maximum width of the specified column in characters. |
|
Returns the fully qualified Java class name of the column values. |
|
Returns the precision of the specified column. |
|
Returns the number of digits to the right of the decimal point for the specified column. |
|
Returns the name of the table containing the specified column. |
|
Returns the schema name of the specified column. |
|
Returns the catalog name of the specified column. |
|
Checks whether the specified column is automatically numbered. |
|
Checks whether the specified column is case-sensitive. |
|
Checks whether the specified column contains a currency value. |
|
Checks whether a value in the specified column can definitely be written. |
|
Returns whether the specified column can contain SQL |
|
Checks whether the specified column is read-only. |
|
Checks whether the specified column can be used in a |
|
Checks whether values in the specified column are signed numbers. |
|
Checks whether a value in the specified column can be written. |
Methods of DatabaseMetaData
| Method Signature and Short Description |
|---|
|
Returns the name of the database product. |
|
Returns the version number of the database product. |
|
Returns the name of the JDBC driver. |
|
Returns the version number of the JDBC driver. |
|
Returns the user name used for the current database connection. |
|
Returns the URL used to establish the database connection. |
|
Checks whether the database connection is read-only. |
|
Returns the maximum number of concurrent connections supported by the database. |
|
Returns the maximum number of tables that can be used in a |
|
Checks whether the database supports transactions. |
|
Checks whether the database supports batch updates. |
|
Checks whether the database supports stored procedures. |
|
Checks whether the database supports the specified |
|
Checks whether the database supports the specified |
|
Returns a comma-separated list of database-specific SQL keywords. |
|
Returns a comma-separated list of supported numeric functions. |
|
Returns a comma-separated list of supported string functions. |
|
Returns a comma-separated list of supported time and date functions. |
|
Returns information about tables available in the database. |
|
Returns information about columns available in the specified tables. |
|
Returns information about the primary keys of the specified table. |
|
Returns information about foreign keys imported by the specified table. |
|
Returns information about foreign keys exported by the specified table. |
|
Returns information about indexes and statistics for the specified table. |
|
Returns the database vendor’s preferred term for a catalog. |
|
Returns the database vendor’s preferred term for a schema. |
|
Returns the database vendor’s preferred term for a procedure. |
