I cannot retrieve tables in SQL Server 2012.
Using the API, I cannot get any table. If I set schema support to false, I get the table, but no columns:
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());
}
}
Using sc.cmd, I don't get any table at all:
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
I tried on MySQL, and it works fine.
Got it to work by adding catalog name (i.e. "catalog_name.schema_name") to the schema name.