DB2 10.5 for Linux, UNIX, and Windows

DB2Connection.GetSchema (String) Method

Returns a DataTable with a specified set of metadata for the data source associated with this DB2Connection instance.

Namespace:
IBM.Data.DB2
Assembly:
IBM.Data.DB2 (in IBM.Data.DB2.dll)

Syntax

[Visual Basic]
Public Overrides Function GetSchema ( _
   collectionName As String _
) As DataTable
[C#]
public override DataTable GetSchema (
   string collectionName
);
[C++]
public:
virtual DataTable^ GetSchema (
   String collectionName
) override
[JScript]
public override function GetSchema (
   collectionName : String
) : DataTable

Parameters

collectionName
Specifies the set of data source metadata to return. The following table lists read-only string properties you can use to identify the metadata collection GetSchema will return.
Collection name Description
DB2MetaDataCollectionNames.MetaDataCollections A list of the metadata collections supported by the IBM® Data Provider for .NET.
DB2MetaDataCollectionNames.Restrictions For each metadata collection, a list of qualifiers that can be used to restrict the scope of the requested metadata.
DB2MetaDataCollectionNames.DataSourceInformation Information about the data source associated with this DB2Connection instance.
DB2MetaDataCollectionNames.DataTypes A list of all the data types supported by DB2® family databases.
DB2MetaDataCollectionNames.ReservedWords A list of all the reserved words for the DB2 family SQL dialect.
DB2MetaDataCollectionNames.Tables A list of the tables in the data source associated with this DB2Connection instance.
DB2MetaDataCollectionNames.TablePrivileges A list of the table privileges in the data source associated with this DB2Connection instance.
DB2MetaDataCollectionNames.Columns A list of the table columns in the data source associated with this DB2Connection instance.
DB2MetaDataCollectionNames.ColumnPrivileges A list of the column privileges in the data source associated with this DB2Connection instance.
DB2MetaDataCollectionNames.Procedures A list of the stored procedures in the data source associated with this DB2Connection instance.
DB2MetaDataCollectionNames.ProcedureParameters A list of the stored procedure parameters in the data source associated with this DB2Connection instance.
DB2MetaDataCollectionNames.PrimaryKeys A list of the table primary keys in the data source associated with this DB2Connection instance.
DB2MetaDataCollectionNames.ForeignKeys A list of the table foreign keys in the data source associated with this DB2Connection instance.
DB2MetaDataCollectionNames.Indexes A list of the indexes in the data source associated with this DB2Connection instance.
DB2MetaDataCollectionNames.Schemas A list of the schemas in the data source associated with this DB2Connection instance.

Return value

A DataTable instance, which contains information about the visible DB2 family databases.

Example

[C#] The following line of code demonstrates how to retrieve the available metadata for the data source associated with this DB2Connection instance. The use of this particular overload of GetSchema (with a String parameter) results in the retrieval of a list of the stored procedures cataloged in the data source.

[C#]
    DataTable proctable = conn.GetSchema(DB2MetaDataCollectionNames.Procedures);