schema crawler - 表名模式不能为NULL或为空

时间:2017-02-22 15:32:59

标签: schemacrawler

我正在运行以下命令: schemacrawler.cmd -server = mysql -database = prepaid -infolevel = minimum -command = list -loglevel = CONFIG -url = jdbc:mysql://127.0.0.1:3306 / prepaid -u = root -schemas = prepaid

我收到以下错误:

Feb 22, 2017 5:11:48 PM us.fatehi.commandlineparser.CommandLineUtility logFullStackTrace
SEVERE: Exception retrieving table information: Table name pattern can not be NULL or empty.
schemacrawler.schemacrawler.SchemaCrawlerException: Exception retrieving table information: Table name pattern can not be NULL or empty.
        at schemacrawler.crawl.SchemaCrawler.crawlTables(SchemaCrawler.java:739)
        at schemacrawler.crawl.SchemaCrawler.crawl(SchemaCrawler.java:797)
        at schemacrawler.tools.executable.BaseStagedExecutable.execute(BaseStagedExecutable.java:91)
        at schemacrawler.tools.commandline.SchemaCrawlerCommandLine.execute(SchemaCrawlerCommandLine.java:129)
        at schemacrawler.Main.main(Main.java:90)
Caused by: java.sql.SQLException: Table name pattern can not be NULL or empty.
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:545)
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:513)
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:505)
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:479)
        at com.mysql.cj.jdbc.DatabaseMetaData.getTables(DatabaseMetaData.java:3836)
        at schemacrawler.crawl.TableRetriever.retrieveTables(TableRetriever.java:114)
        at schemacrawler.crawl.SchemaCrawler.lambda$crawlTables$26(SchemaCrawler.java:570)
        at schemacrawler.crawl.SchemaCrawler$$Lambda$41/1559122513.call(Unknown Source)
        at sf.util.StopWatch.time(StopWatch.java:156)
        at schemacrawler.crawl.SchemaCrawler.crawlTables(SchemaCrawler.java:567)
        ... 4 more

================= 请指教

1 个答案:

答案 0 :(得分:2)

请遵循Driver/Datasource Class Names, URL Syntax and Configuration Properties for Connector/J上的文档,确保使用正确的MySQL数据库连接URL。特别是,您需要像这样设置nullNamePatternMatchesAll=true

schemacrawler.cmd -server=mysql -database=prepaid -infolevel=minimum -command=list -loglevel=CONFIG -url=jdbc:mysql://127.0.0.1:3306/prepaid?nullNamePatternMatchesAll=true -u=root -schemas=prepaid

或者更好的是,使用SchemaCrawler对MySQL的内置支持,这样更容易:

schemacrawler.cmd -server=mysql -host=127.0.0.1 -database=prepaid -infolevel=minimum -command=list -loglevel=CONFIG -u=root -schemas=prepaid

Sualeh Fatehi,SchemaCrawler