DB2®Connection.GetSchema () Method
Returns a DataTable that contains metadata for the data source that is associated with a DB2Connection instance.
- Namespace:
IBM.Data.DB2- Assembly:
IBM.Data.DB2(inIBM.Data.DB2.dll)
Syntax
[Visual Basic]
Public Overrides Function GetSchema As DataTable
[C#]
public override DataTable GetSchema ()
[C++]
public:
virtual DataTable^ GetSchema () override
[JScript]
public override function GetSchema () : DataTable
Return value
A DataTable instance,
which contains metadata for the data source associated with this DB2Connection instance.
Returned DataTable instance contains:
- String values of DB2MetaDataCollectionNames enumeration supported by the connection.
- Number of restriction values that can be specified for each metadata
collection. Output example of collection name and associated number
of restrictions are shown in table 1.
Table 1. Output example of collection name and associated number of restrictions CollectionName NumberOfRestrictions DataSourceInformation 0 TablePrivileges 3 ColumnPrivileges 4 Restrictions 0 Columns 4 ProcedureParameters 5 MetaDataCollections 0 Indexes 5 Procedures 4 DataTypes 0 Catalogs 0 PrimaryKeys 3 Tables 4 ForeignKeys 6 ReservedWords 0 Schemas 0
Example
[C#] The following line of C# code demonstrates how to retrieve the available metadata for the data source that is associated with a DB2Connection instance. The application can use the module name as one of the restrictions.
[C#]
DataTable table2 = conn.GetSchema();
Example of values returned by the GetSchema method
are as follows:TABLE_SCHEMA=ADMINISTRATOR
TABLE_SCHEMA=NULLID
-
-
TABLE_SCHEMA=SYSSTAT