Skip to main content
Skip table of contents

Retrieving referenced foreign keys

The JDBC Metadata Explorer enables the retrieval of foreign keys in other tables that reference to the specified database table.

Input

Add the element <exportedkeys resulttag="ResultElementName"/> to an input XML document with any root element, and specify a valid XML name within the attribute resulttag. It is required to specify a table within the element <table>; the elements <catalog> and <schema> are optional here.

HTML/XML
<Root>
  <exportedkeys resulttag="ResultElementName">
     <catalog>Catalog</catalog>
     <schema>Database schema</schema>
     <table>Database table (mandatory, may not be empty)</table>
   </exportedkeys>
</Root>

Output

The output XML structure contains a root element <Data> with a child element whose name has been specified in the input structure within the attribute resulttag. It contains metadata to each foreign key in other tables that reference to primary key of the specified table. If there are multiple result sets (i. e. more than one foreign key column), each will be output in a separate element.

HTML/XML
<Data>
   <ResultElementName>
      <ForeignKeyProperty> Value </ForeignKeyProperty>
      ...
   </ResultElementName>
</Data>

Further information on each column property can be found here.

Example

An input XML document contains the following XML structure to output the foreign key references of the table Provider:

HTML/XML
<Root>
   <exportedkeys resulttag="keys">
      <table>Operator</table>
   </exportedkeys>    
</Root>

Then, the JDBC Metadata Explorer outputs e. g. the following result XML document:

HTML/XML
<Data>
   <keys>
      <PKTABLE_CAT>port</PKTABLE_CAT>
      <PKTABLE_SCHEM>dbo</PKTABLE_SCHEM>
      <PKTABLE_NAME>OPERATOR</PKTABLE_NAME>
      <PKCOLUMN_NAME>OPERATOR_ID</PKCOLUMN_NAME>
      <FKTABLE_CAT>port</FKTABLE_CAT>
      <FKTABLE_SCHEM>dbo</FKTABLE_SCHEM>
      <FKTABLE_NAME>ROLEMAP</FKTABLE_NAME>
      <FKCOLUMN_NAME>OPERATOR_ID</FKCOLUMN_NAME>
      <KEY_SEQ>1</KEY_SEQ>
      <UPDATE_RULE>1</UPDATE_RULE>
      <DELETE_RULE>1</DELETE_RULE>
      <FK_NAME>FK_ROLEMAP_OPERATOR</FK_NAME>
      <PK_NAME>PK_OPERATOR</PK_NAME>
      <DEFERRABILITY>7</DEFERRABILITY>
   </keys>
</Data>
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.