What Is ResultSet Metadata? JDBC

What is metadata? Metadata is data about data, which provides structured descriptive information about other data. Result set metadata relieves the user of having to obtain full knowledge of the characteristics of relational databases in advance. Therefore, we conclude that metadata describes the data and its properties, but is not the actual data itself. For example, the records in a card catalog in a local library give brief details about the actual book. A record provides enough information to know what the book is called, its unique identification number, and how and where to find it. These details are metadata—in this case, bibliographic elements such as author, title, abstract, publisher, and published date.

In a nutshell, result set metadata enables dynamic discovery of a ResultSet object’s structure. Typically, most JDBC programmers will be programming with knowledge of their target database’s schema definitions (the names of tables, views, columns, and their associated types). In this case, programmers can use the strongly typed JDBC interfaces. However, there is also another important class of database access where an application (or an application builder) dynamically generates the result sets from ad hoc queries (submitted by different clients). This chapter describes the JDBC support for dynamic access.

ResultSet metadata has many applications. It can be used to

  • Discover the number of columns, column names, types, and length
  • Find out the table names for all columns in the result set
  • Determine whether a given column is readable/writable
  • Determine whether a given column is searchable (indicates whether the designated

column can be used in a SQL WHERE clause or in SQL SELECT, UPDATE, and DELETE queries) As we observe, metadata not only enables us to do effective management of resources, but also helps us to use metadata to find the data we need and determine how best to use it. Also, metadata provides structured descriptions of database information resources and services.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

JDBC Topics