Getting MetaData from the Database

The public Java interface called java.sql.DatabaseMetaData defines methods that allow the JDBC developer to obtain detailed pieces of information about the database as a whole. There are many, many methods contained within this interface. Because it is an interface, there must be a concrete class that implements the interface so that the methods can be called. This concrete class is the Connection class itself. You can call the getMetaData method on a Connection object and obtain the metadata for the database that the Connection is connected to. After you have the metadata, you can query for just about anything that you want to know about the database. The example in Listing 26.15 shows some of the information ...

Get Special Edition Using Java 2 Standard Edition 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.