当我使用
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.39</version>
</dependency>
这个驱动版本时,进行生成数据库的操作
/**
* 生成数据库字典
*
* @param outputPath 输出目录
* @param fileName 数据文件名
*/
public void generatorDatabaseMetaData(String outputPath,
String fileName) {
logger.info("准备生成TableMeta");
MetaBuilder metaBuilder = new MetaBuilder(dataSource);
metaBuilder.setDialect(new MysqlDialect());
List<TableMeta> tableMetas = metaBuilder.build();
if (tableMetas.size() == 0) {
logger.info("TableMeta 数量为 0,不生成任何文件");
return;
}
DataDictionaryGenerator dataDictionaryGenerator = new DataDictionaryGenerator(dataSource, outputPath);
dataDictionaryGenerator.setDataDictionaryFileName(fileName);
dataDictionaryGenerator.generate(tableMetas);
logger.info("TableMeta生成完毕");
}
这时候是没有问题的。但是我换成下面的版本
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>6.0.3</version>
</dependency>
生成就出现了问题。后台报错
java.lang.RuntimeException: java.sql.SQLException: Table name pattern can not be NULL or empty. at com.jfinal.plugin.activerecord.generator.MetaBuilder.build(MetaBuilder.java:102) at sunyu.tools.dbtools.DbTools.generatorDatabaseMetaData(DbTools.java:55) at test.sunyu.tools.dbtools.TestDbTools.t1(TestDbTools.java:23) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:252) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:117) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:262) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:84) Caused by: java.sql.SQLException: Table name pattern can not be NULL or empty. at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:695) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:663) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:653) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:638) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:606) at com.mysql.cj.jdbc.DatabaseMetaDataUsingInfoSchema.getTables(DatabaseMetaDataUsingInfoSchema.java:727) at com.jfinal.plugin.activerecord.generator.MetaBuilder.getTablesResultSet(MetaBuilder.java:158) at com.jfinal.plugin.activerecord.generator.MetaBuilder.buildTableNames(MetaBuilder.java:162) at com.jfinal.plugin.activerecord.generator.MetaBuilder.build(MetaBuilder.java:94) ... 30 more
mysql
mysql-connector-java
6.0.4