JDBC Tutorials - Herong's Tutorial Notes
Dr. Herong Yang, Version 2.11

Commonly Used DatabaseMetaData Methods

This section provides a list of commonly used DatabaseMetaData methods for obtaining information on database objects like tables, and stored procedures.

JDBC database meta data is a collection of information reported by the JDBC driver about the connected database. This collection of information can be obtained by con.getMetaData as a DatabaseMetaData object. Detailed information can be retrieved with various methods offered on the DatabaseMetaData object. Some of them are:

  • getDatabaseProductName() - Retrieves the name of this database product.
  • getDatabaseProductVersion() - Retrieves the version number of this database product.
  • getDriverName() - Retrieves the name of this JDBC driver.
  • getDriverVersion() - Retrieves the version number of this JDBC driver as a String.
  • getJDBCMinorVersion() - Retrieves the minor JDBC version number for this driver.
  • getJDBCMajorVersion() - Retrieves the major JDBC version number for this driver.
  • getUserName() - Retrieves the user name as known to this database.
  • getCatalogs() - Retrieves the catalog names available in this database.
  • getSchemas(String catalog, String schemaPattern) - Retrieves the schema names available in this database.
  • getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) - Retrieves a description of the tables available in the given catalog.
  • getPrimaryKeys(String catalog, String schema, String table) - Retrieves a description of the given table's primary key columns.
  • getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) - Retrieves a description of table columns available in the specified catalog.
  • getProcedures(String catalog, String schemaPattern, String procedureNamePattern) - Retrieves a description of the stored procedures available in the given catalog.
  • getProcedureColumns(String catalog, String schemaPattern, String procedureNamePattern, String columnNamePattern) - Retrieves a description of the given catalog's stored procedure parameter and result columns.
  • getFunctions(String catalog, String schemaPattern, String functionNamePattern) - Retrieves a description of the system and user functions available in the given catalog.
  • getFunctionColumns(String catalog, String schemaPattern, String functionNamePattern, String columnNamePattern) - Retrieves a description of the given catalog's system or user function parameters and return type.

Table of Contents

 About This Book

 JDBC (Java Database Connectivity) Introduction

 Downloading and Installing JDK - Java SE

 Installing and Running Java DB - Derby

 Derby (Java DB) JDBC Driver

 Derby (Java DB) JDBC DataSource Objects

 Java DB (Derby) - DML Statements

 Java DB (Derby) - ResultSet Objects of Queries

 Java DB (Derby) - PreparedStatement

 MySQL Installation on Windows

 MySQL JDBC Driver (MySQL Connector/J)

 MySQL - PreparedStatement

 MySQL - Reference Implementation of JdbcRowSet

 MySQL - JBDC CallableStatement

 MySQL CLOB (Character Large Object) - TEXT

 MySQL BLOB (Binary Large Object) - BLOB

 Oracle Express Edition Installation on Windows

 Oracle JDBC Drivers

 Oracle - Reference Implementation of JdbcRowSet

 Oracle - PreparedStatement

 Oracle - JBDC CallableStatement

 Oracle CLOB (Character Large Object) - TEXT

 Oracle BLOB (Binary Large Object) - BLOB

 Microsoft SQL Server 2005 Express Edition

 Microsoft JDBC Driver for SQL Server - sqljdbc.jar

 Microsoft JDBC Driver - Query Statements and Result Sets

Microsoft JDBC Driver - DatabaseMetaData Object

Commonly Used DatabaseMetaData Methods

 Getting Database Server and Driver Info

 Listing All Databases - getCatalogs()

 Listing All Schemas - getSchemas()

 Listing All Tables - getTables()

 Listing All Culumns - getColumns()

 Listing All Stored Procedures - getProcedures()

 Microsoft JDBC Driver - DDL Statements

 Microsoft JDBC Driver - DML Statements

 SQL Server - PreparedStatement

 SQL Server CLOB (Character Large Object) - TEXT

 SQL Server BLOB (Binary Large Object) - BLOB

 JDBC-ODBC Bridge Driver - sun.jdbc.odbc.JdbcOdbcDriver

 JDBC-ODBC Bridge Driver - Flat Text Files

 JDBC-ODBC Bridge Driver - MS Access

 JDBC-ODBC Bridge Driver - MS SQL Server

 Summary of JDBC Drivers and Database Servers

 Additional Tutorial Notes to Be Added

 References

 PDF Printing Version

Dr. Herong Yang, updated in 2007
Commonly Used DatabaseMetaData Methods