public class ConnectionMetaData extends Object
ConnectionMetaData provides convenient api to access the meta-data of a jdbc connection.
Connection jdbcConnection = ...;
ConnectionMetaData metaData = new ConnectionMetaData(jdbcConnection);
ForeignKeyList foreignKeys = metaData.getImportedKeys("film_actor");
ColumnMetaDataList filmActorColumns = metaData.getColumnMetaDataList("film_actor");
ForeignKey foreignKey = foreignKeys.getByFkColumnDescription(filmActorColumns.getByName("actor_id"));
assertNotNull(foreignKey);
assertEquals("fk_film_actor_actor", foreignKey.getName());
ColumnMetaDataList actorColumns = metaData.getColumnMetaDataList("actor");
foreignKey = foreignKeys.getByPkColumnDescription(actorColumns.getByName("actor_id"));
assertNotNull(foreignKey);
assertEquals("fk_film_actor_actor", foreignKey.getName());

| Constructor and Description |
|---|
ConnectionMetaData(Connection connection) |
ConnectionMetaData(Connection connection,
JdbcContext context) |
ConnectionMetaData(Connection connection,
JdbcContext context,
String... tableTypes) |
ConnectionMetaData(Connection connection,
String... tableTypes) |
| Modifier and Type | Method and Description |
|---|---|
ColumnMetaDataList |
getColumnMetaDataList(String tableName) |
List<ColumnMetaData> |
getColumnMetaDataList(TableMetaData jdbcTableMetaData) |
ForeignKeyList |
getExportedKeys(String tableName) |
ForeignKeyList |
getImportedKeys(String tableName) |
PrimaryKey |
getPrimaryKey(String tableName) |
TableMetaData |
getTableMetaData(String tableName) |
List<TableMetaData> |
getTableMetaDataList() |
public ConnectionMetaData(Connection connection)
public ConnectionMetaData(Connection connection, String... tableTypes)
public ConnectionMetaData(Connection connection, JdbcContext context)
public ConnectionMetaData(Connection connection, JdbcContext context, String... tableTypes)
public List<TableMetaData> getTableMetaDataList() throws SQLException
SQLExceptionpublic TableMetaData getTableMetaData(String tableName) throws SQLException
SQLExceptionpublic List<ColumnMetaData> getColumnMetaDataList(TableMetaData jdbcTableMetaData) throws SQLException
SQLExceptionpublic PrimaryKey getPrimaryKey(String tableName) throws SQLException
SQLExceptionpublic ColumnMetaDataList getColumnMetaDataList(String tableName) throws SQLException
SQLExceptionpublic ForeignKeyList getExportedKeys(String tableName) throws SQLException
SQLExceptionpublic ForeignKeyList getImportedKeys(String tableName) throws SQLException
SQLExceptionCopyright © 2011–2022 Link Intersystems GmbH. All rights reserved.