Working with Metadata

Metadata is data about data, and in the context of our study of JDBC, it's the information provided about the properties of data sources and result sets. Querying metadata is very powerful in creating tools for database manipulation and sophisticated database applications.

To find information about the connected database, we use the method getMetaData() of the Connection object to retrieve a DatabaseMetaData object. You can get information about schemas, tables, and properties of each table. The following sample queries database metadata to display all the table names and properties of each table in the schema "APP":

 // Finding MetaData about database DatabaseMetaData dbmd = conn.getMetaData(); String[] types = {"TABLE"}; ...

Get Sams Teach Yourself EJB in 21 Days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.