Schemacrawler 无法在 SQL 服务器中检索 table
Schemacrawler cannot retrieve table in SQL Server
我无法在 SQL Server 2012 中检索 tables。
使用 API,我无法获得任何 table。如果我将模式支持设置为 false,我会得到 table,但没有列:
SchemaCrawlerOptions options = new SchemaCrawlerOptions();
options.setSchemaInclusionRule(new RegularExpressionInclusionRule(databaseName));
options.setRoutineInclusionRule(new ExcludeAll());
//options.getDatabaseSpecificOverrideOptions().setSupportsSchemas(false);
options.setTableInclusionRule(new RegularExpressionInclusionRule("(?i)|databaseName.\W?+myTable\W?+"));
options.setSchemaInfoLevel(SchemaInfoLevel.standard());
Catalog database = SchemaCrawlerUtility.getCatalog(connection, options);
for (Table t : database.getTables()) {
System.out.println("Table: " + t.getName());
for (Column c : t.getColumns()) {
System.out.println("Column: " + c.getName());
}
}
使用 sc.cmd,我根本没有得到任何 table:
sc -url=jdbc:jtds:sqlserver://<server>:1433/<dbname> -user=<user> -password=<pwd> -c=brief -infolevel=standard -schemas=<dbname> -tables=.*\.<mytable>.* -outputformat=text
System Information
========================================================================
SchemaCrawler Information
-=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=-
product name SchemaCrawler
product version 12.06.03
Database Information
-=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=-
database product name Microsoft SQL Server
database product version 11.00.3128
database user name <user>
JDBC Driver Information
-=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=-
driver name jTDS Type 4 JDBC Driver for MS SQL Server and Sybase
driver version 1.3.1
driver class name net.sourceforge.jtds.jdbc.Driver
url jdbc:jtds:sqlserver://<server>:1433/<dbname>
is JDBC compliant false
我试过 MySQL,效果很好。
通过将目录名称(即 "catalog_name.schema_name")添加到模式名称使其工作。
知道它只适用于以下选项:options.setSchemaInfoLevel(SchemaInfoLevel.standard());
我无法在 SQL Server 2012 中检索 tables。
使用 API,我无法获得任何 table。如果我将模式支持设置为 false,我会得到 table,但没有列:
SchemaCrawlerOptions options = new SchemaCrawlerOptions();
options.setSchemaInclusionRule(new RegularExpressionInclusionRule(databaseName));
options.setRoutineInclusionRule(new ExcludeAll());
//options.getDatabaseSpecificOverrideOptions().setSupportsSchemas(false);
options.setTableInclusionRule(new RegularExpressionInclusionRule("(?i)|databaseName.\W?+myTable\W?+"));
options.setSchemaInfoLevel(SchemaInfoLevel.standard());
Catalog database = SchemaCrawlerUtility.getCatalog(connection, options);
for (Table t : database.getTables()) {
System.out.println("Table: " + t.getName());
for (Column c : t.getColumns()) {
System.out.println("Column: " + c.getName());
}
}
使用 sc.cmd,我根本没有得到任何 table:
sc -url=jdbc:jtds:sqlserver://<server>:1433/<dbname> -user=<user> -password=<pwd> -c=brief -infolevel=standard -schemas=<dbname> -tables=.*\.<mytable>.* -outputformat=text
System Information
========================================================================
SchemaCrawler Information
-=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=-
product name SchemaCrawler
product version 12.06.03
Database Information
-=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=-
database product name Microsoft SQL Server
database product version 11.00.3128
database user name <user>
JDBC Driver Information
-=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=-
driver name jTDS Type 4 JDBC Driver for MS SQL Server and Sybase
driver version 1.3.1
driver class name net.sourceforge.jtds.jdbc.Driver
url jdbc:jtds:sqlserver://<server>:1433/<dbname>
is JDBC compliant false
我试过 MySQL,效果很好。
通过将目录名称(即 "catalog_name.schema_name")添加到模式名称使其工作。
知道它只适用于以下选项:options.setSchemaInfoLevel(SchemaInfoLevel.standard());