How do I use schema crawler to establish a connection with the database and get the result?

218 views Asked by At

I'm using this Gradle dependency in my project

implementation group: 'us.fatehi', name: 'schemacrawler', version: '16.16.14'

The project is in Scala language and DB2 is the database that's used.

This is piece if scala code I'm using:

val limitOptionsBuilder = LimitOptionsBuilder.builder
           .includeSchemas(new RegularExpressionInclusionRule("schema_name"))
           .includeTables((tableName: String) => !tableName.contains("table_name_thats_in_the_above_scema"))

val loadOptionsBuilder = LoadOptionsBuilder.builder.withSchemaInfoLevel(SchemaInfoLevelBuilder.standard())

val options = SchemaCrawlerOptionsBuilder.newSchemaCrawlerOptions
                  .withLimitOptions(limitOptionsBuilder.toOptions())
                  .withLoadOptions(loadOptionsBuilder.toOptions())


var catalog :Catalog = null
catalog = SchemaCrawlerUtility.getCatalog(connection, options)

I'm getting this below exception:

SchemaCrawler database plugin should be on the CLASSPATH for <my_db2_classpath>,
or "SC_WITHOUT_DATABASE_PLUGIN" should be set to the name of the missing plugin
either as an environmental variable or as a Java system property

Is there any other setup that I need to do before using Schemacrawler to connect to the database? Ideally, I need to connect to the database and get the relations between the tables in the form of ER diagram in HTML/PDF format.

1

There are 1 answers

5
Sualeh Fatehi On BEST ANSWER