当我将此代码添加到pom.xml中时:
<!-- https://mvnrepository.com/artifact/us.fatehi/schemacrawler-mariadb -->
<dependency>
<groupId>us.fatehi</groupId>
<artifactId>schemacrawler-mariadb</artifactId>
<version>14.08.06</version>
</dependency>然后我得到一个错误:
java.util.ServiceConfigurationError: schemacrawler.tools.databaseconnector.DatabaseConnector: Provider schemacrawler.server.mariadb.MariaDBDatabaseConnector could not be instantiated
..
Caused by: java.lang.NoSuchMethodError: schemacrawler.tools.databaseconnector.DatabaseConnector.<init>(Lschemacrawler/tools/databaseconnector/DatabaseServerType;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V我正在尝试连接到Oracle数据库。如果我在pom中省略了MariaDb,这将起作用。
我使用的是更高版本的SchemaCrawler:
<dependency>
<groupId>us.fatehi</groupId>
<artifactId>schemacrawler</artifactId>
<version>14.21.02</version>
</dependency>
<!-- https://mvnrepository.com/artifact/us.fatehi/schemacrawler-oracle -->
<dependency>
<groupId>us.fatehi</groupId>
<artifactId>schemacrawler-oracle</artifactId>
<version>14.21.02</version>
</dependency>我希望将MariaDB放在pom.xml中,并且仍然能够使用SchemaCrawler读取Oracle。错误发生在连接到数据库之后,在以下代码的最后一行:
Connection dbConnection = DatabaseBroker.getDbConnection(
eventName,
cbDatabase.getValue(),
tConnectionString.getValue(),
tUsername.getValue(),
tPassword.getValue()
);
//Schema schema = SchemaCrawler.getSchema(dbConnection, SchemaInfoLevel.detailed(), new SchemaCrawlerOptions());
//SchemaCrawler sc = new SchemaCrawler(dbConnection, null);
try
{
Catalog catalog = SchemaCrawlerUtility.getCatalog(dbConnection, null);发布于 2018-07-27 10:14:51
您使用的是主SchemaCrawler库和SchemaCrawler数据库插件的不兼容版本。如果要连接到MariaDB,则不需要用于Oracle的插件。事实上,即使在类路径上没有SchemaCrawler数据库插件,SchemaCrawler也可以与大多数数据库一起工作。
https://stackoverflow.com/questions/51514984
复制相似问题