javaoracle-databasemariadbschemacrawler

SchemaCrawler error when adding MariaDB artifact


When I add this to the 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>

Then I get an error:

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

I am trying to connect to an Oracle database. This works if I omit MariaDb from the pom.

I am using a higher version of 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>

I would like to have the MariaDB in the pom.xml and still be able to read Oracle with SchemaCrawler. The error occurs after connecting to the database, in the last line of the following code:

        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);

Solution

  • You are using incompatible versions of the main SchemaCrawler library and a SchemaCrawler database plugin. You do not need a plugin for MariaDB if you are connecting to Oracle. In fact, SchemaCrawler will work with most databases even without a SchemaCrawler database plugin on the classpath.