Get a list of available Schemas and Tables via any ODBC driver

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • JB

    Get a list of available Schemas and Tables via any ODBC driver

    Hi All,

    I'm writing an application that connects to various databases via
    ODBC.
    I'd like to get a list of all the available Schemas and Tables in a
    Database. It looks like the GetSchema function is what I need, however
    there seem to be slight differences between various drivers.

    For instance when calling GetSchema("Tabl es") the SQL Server ODBC
    driver returns the following columns:
    TABLE_CAT String
    TABLE_SCHEM String
    TABLE_NAME String
    TABLE_TYPE String
    REMARKS String

    And the Oracle ODBC driver returns
    TABLE_QUALIFIER String
    TABLE_OWNER String
    TABLE_NAME String
    TABLE_TYPE String
    REMARKS String

    The first 2 columns don't have the same name, but I'd like to use only
    one code for all types of ODBC driver. So my question is can I rely on
    the position of these columns (i.e. second column for Table Schema or
    Table Owner, third column for Table Name)?
    Will these columns always be in the same position for any other ODBC
    driver?

    Thanks
    JB
Working...