Java Packages For Jdbc Support; Learning About A Data Source Using Databasemetadata Methods - IBM DB2 Manual

Table of Contents

Advertisement

Java packages for JDBC support

Before you can invoke JDBC methods, you need to be able to access all or parts of
various Java packages that contain those methods.
You can do that either by importing the packages or specific classes, or by using
the fully-qualified class names. You might need the following packages or classes
for your JDBC program:
java.sql
javax.naming
javax.sql
com.ibm.db2.jcc

Learning about a data source using DatabaseMetaData methods

The DatabaseMetaData interface contains methods that retrieve information about a
data source. These methods are useful when you write generic applications that
can access various data sources.
In generic applications that can access various data sources, you need to test
whether a data source can handle various database operations before you execute
them. For example, you need to determine whether the driver at a data source is at
the JDBC 3.0 level before you invoke JDBC 3.0 methods against that driver.
DatabaseMetaData methods provide the following types of information:
v Features that the data source supports, such as the ANSI SQL level
v Specific information about the JDBC driver, such as the driver level
v Limits, such as the maximum number of columns that an index can have
v Whether the data source supports data definition statements (CREATE, ALTER,
v Lists of objects at the data source, such as tables, indexes, or procedures
v Whether the data source supports various JDBC functions, such as batch updates
v A list of scalar functions that the driver supports
To invoke DatabaseMetaData methods, you need to perform these basic steps:
1. Create a DatabaseMetaData object by invoking the getMetaData method on the
2. Invoke DatabaseMetaData methods to get information about the data source.
Related reference
"Properties for the IBM Data Server Driver for JDBC and SQLJ" on page 201
"DB2SimpleDataSource class" on page 352
"DB2XADataSource class" on page 366
Contains the core JDBC API.
Contains classes and interfaces for Java Naming and Directory Interface
(JNDI), which is often used for implementing a DataSource.
Contains methods for producing server-side applications using Java
Contains the implementation of JDBC for the IBM Data Server Driver for
JDBC and SQLJ.
Related concepts
"Example of a simple JDBC application" on page 7
DROP, GRANT, REVOKE)
or scrollable ResultSets
connection.
Chapter 3. JDBC application programming
21

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents