我想比较一下
>表格
>列包括数据类型和长度/精度.
>索引及其列
>约束
在两个数据库模式中是相同的.
解决方法:
我不知道用于模式比较的高级API我使用DatabaseMetaData并不难找到差异i.g来解除所有表格你可以做这样的事情:
DatabaseMetaData Meta = con.getMetaData();
ResultSet res = Meta.getTables(null, null, null,
new String[] {"TABLE"});
System.out.println("List of tables: ");
while (res.next()) {
System.out.println(
" "+res.getString("TABLE_CAT")
+ ", "+res.getString("TABLE_SCHEM")
+ ", "+res.getString("TABLE_NAME")
+ ", "+res.getString("TABLE_TYPE")
+ ", "+res.getString("REMARKS"));
}
res.close();
以下方法对您的意图也很重要:
getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern)
getExportedKeys(String catalog, String schema, String table)
getIndexInfo(String catalog, String schema, String table, boolean unique, boolean approximate)
getPrimaryKeys(String catalog, String schema, String table)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。