I am developing a Java application using SchemaCrawler (us.fatehi:schemacrawler:16.25.2
), where users will configure their desired JDBC drivers for their specific databases. It's possible that multiple drivers could be used simultaneously. However, SchemaCrawler might not natively support these drivers as it does with popular database systems. To address this, I load the necessary drivers dynamically using a URLClassLoader
.
The issue I'm encountering is that I cannot work with multiple drivers at the same time because I need to set SC_WITHOUT_DATABASE_PLUGIN
environment. This seems to prevent me from using multiple third-party drivers concurrently.
Am I missing something in my approach? Or is there currently no way in SchemaCrawler to work with multiple third-party JDBC drivers at the same time?
At the moment, I can use SchemaCrawler only for a specific DBMS if I set the SC_WITHOUT_DATABASE_PLUGIN
name for that DBMS, but it won't work for another DBMS until SC_WITHOUT_DATABASE_PLUGIN
is changed.
Example of error log:
���. 21, 2025 12:40:49 AM schemacrawler.tools.utility.SchemaCrawlerUtility buildSchemaRetrievalOptions
INFO: Not using any SchemaCrawler database plugin
Exception in thread "main" schemacrawler.schemacrawler.exceptions.InternalRuntimeException: Add the SchemaCrawler database plugin for <postgresql> to the CLASSPATH for
<jdbc:postgresql://localhost:5432/postgres>
or set "SC_WITHOUT_DATABASE_PLUGIN=postgresql"
either as an environmental variable or as a Java system property
at schemacrawler.tools.utility.SchemaCrawlerUtility.useMatchedDatabasePlugin(SchemaCrawlerUtility.java:297)
at schemacrawler.tools.utility.SchemaCrawlerUtility.buildSchemaRetrievalOptions(SchemaCrawlerUtility.java:203)
at schemacrawler.tools.utility.SchemaCrawlerUtility.matchSchemaRetrievalOptions(SchemaCrawlerUtility.java:145)
at schemacrawler.tools.utility.SchemaCrawlerUtility.getCatalog(SchemaCrawlerUtility.java:78)
at org.saakostya.schemaweaver.schemaexplorer.JdbcDriverLoader.printTablesWithSchemaCrawler(JdbcDriverLoader.java:121)
at org.saakostya.schemaweaver.schemaexplorer.JdbcDriverLoader.main(JdbcDriverLoader.java:80)
FAILURE: Build failed with an exception.
@Konstantin, the exception message is clear: "Add the SchemaCrawler database plugin for to the CLASSPATH". That dependency is here: https://central.sonatype.com/artifact/us.fatehi/schemacrawler-postgresql
Similarly, please add all the other available plugins to your CLASSPATH.
Regarding your comment,
SchemaCrawler might not natively support these drivers as it does with popular database systems
SchemaCrawler will support any well behaved (compliant) JDBC driver that is on the CLASSPATH. You can have multiple JDBC drivers on the CLASSPATH at the same time. Loading JDBC drivers dynamically using a URLClassLoader
may be overkill.
NOTE: When I say CLASSPATH here, I mean available as a dependency using the build system you are using, that is, a dependency in Maven or Gradle.