【问题标题】:Schemacrawler ignore schema that can't be accessedSchemacrawler 忽略无法访问的架构
【发布时间】:2012-05-22 02:53:51
【问题描述】:

我目前正在使用Schemacrawler 收集有关各种数据库的信息。

我遇到的问题是运行应用程序的用户无法访问每个数据库。如果我尝试检索模式列表:

SchemaCrawlerOptions schemaCrawlerOptions = new SchemaCrawlerOptions();
schemaCrawlerOptions.setSchemaInfoLevel(SchemaInfoLevel.minimum());
schemaCrawlerOptions.setTableTypes(new TableType[] { TableType.table });

Database database = SchemaCrawlerUtility.getDatabase(connection, schemaCrawlerOptions);
database.getSchemas()

... 引发 SchemaCrawlerException(服务器主体“...”在当前安全上下文下无法访问数据库“...”。)。有没有办法只获取可访问的数据库(无需显式声明每个架构名称)?

【问题讨论】:

标签: java database schema database-metadata schemacrawler


【解决方案1】:

根据您遇到的异常,我假设您使用的是 SQL Server。您需要设置架构包含规则。您可以将其添加到上面的代码 sn-p 中:

schemaCrawlerOptions.setSchemaInclusionRule(new InclusionRule("schema_name.dbo.*", ""));

【讨论】:

  • 我曾考虑过这一点,但只是在检查我是否没有错误地配置某些内容。谢谢。
猜你喜欢
  • 1970-01-01
  • 2020-05-21
  • 2014-07-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-12-13
  • 1970-01-01
  • 2018-10-21
相关资源
最近更新 更多