DB2®Connection.GetSchema (String, 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
(inIBM.Data.DB2.dll
)
Syntax
[Visual Basic]
Public Overrides Function GetSchema ( _
collectionName As String, _
restrictionValues As String() _
) As DataTable
[C#]
public override DataTable GetSchema (
string collectionName,
string[] restrictionValues
);
[C++]
public:
virtual DataTable^ GetSchema (
String collectionName,
array<String^>^ restrictionValues
) override
[JScript]
public override function GetSchema (
collectionName : String,
restrictionValues : 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. - restrictionValues
- You can refine the set of metadata returned by the GetSchema method
by assigning values for the restrictions specific to the applicable
metadata collection. Pass these restrictions values into the GetSchema method
as a String array. To see the list of restrictions
for each metadata collection, read the DataTable generated
by the following code:
DataTable resttable = conn.GetSchema(DB2MetaDataCollectionNames.Restrictions);
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 and a String array parameters) results in the retrieval of
a list of the tables in the data source associated with the ERIK
schema.
[C#]
DataTable eriktab = conn.GetSchema(DB2MetaDataCollectionNames.Tables,
new string[4] { null, "ERIK", null, null } );