我正在为 Oracle 和 MSSQL 使用 SchemaCrawler 8.17。代码是用 Java 实现的。我有以下问题:
- 为 Oracle 数据库花费太多时间。
- 找不到 MSSQL 数据库的架构。
我也尝试使用 INFORMATION SCHEMA VIEWS 来提高性能,但我怀疑 SchemaCrawler 不能为 Oracle 使用 INFORMATION SCHEMA VIEWS。这是代码片段:
DataSource dataSource = new DatabaseConnectionOptions("oracle.jdbc.driver.OracleDriver",
"jdbc:oracle:thin:@xx.xx.xx.xx:orcl");
Connection connection = dataSource.getConnection("xxx", "xxx");
Config config = getSchemaCrawlerConfig(RDBMSType.ORACLE);
SchemaCrawlerOptions options = new SchemaCrawlerOptions(config);
// SchemaCrawlerOptions options = new SchemaCrawlerOptions(config);
SchemaInfoLevel schemaInfoLevel = new SchemaInfoLevel();
schemaInfoLevel.setTag("Custom Info Level");
schemaInfoLevel.setRetrieveTables(true);
schemaInfoLevel.setRetrieveTableColumns(true);
schemaInfoLevel.setRetrieveForeignKeys(true);
schemaInfoLevel.setRetrieveColumnDataTypes(true);
options.setSchemaInfoLevel(schemaInfoLevel);
options.setProcedureInclusionRule(new InclusionRule(InclusionRule.NONE,
InclusionRule.ALL));
options.setSchemaInclusionRule(new InclusionRule("XXX",InclusionRule.NONE));
为了创建配置,我使用以下代码片段:
Properties prop = new Properties();
FileInputStream fs = new FileInputStream(new File("D:\\schemacrawler-oracle.config.properties"));
//InputStream in = ApiExample.class.getResourceAsStream("D:\\schemacrawler-oracle.config.properties");
try {
prop.load(fs);
fs.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Config config = new Config(prop);
如何验证 SchemaCrawler 是否使用 INFORMATION SCHEMA VIEWS?