For SchemaSpy to support your database it must:
The -t command-line parameter specified which type of database you're dealing with.
For example: -t mysql says to use the MySQL-specific database type file
named mysql.properties.
This file, by default, lives in the SchemaSpy jar file, but if you specify a path to the
file then it can also reside on your file system so you can easily modify / experiment
with the file's settings.
Let's start with a simple (and typical) database type file called mysql.properties.
The basic file looks like this:
description=MySQL driver=com.mysql.jdbc.Driver connectionSpec=jdbc:mysql://<host>/<db> host=hostname[:port] host where database resides with optional port db=database nameSee the entire MySQL configuration file here.
-dp (driver path) command-line option to point to the
.jar or .zip that contains this class.
jdbc:mysql://<host>/<db>
connectionSpec.
For example, if you forget to specify -host on the command line then you will
get an error message that includes the text:
hostname[:port] host where database resides with optional port
The idea is to have meaningful error messages / descriptions of these database-specific parameters.
For these SQL-based entries you can use optional "named parameters" in the SQL.
These named parameters are
:schema, :owner, :table and :view.
They will be substituted with appropriate values at runtime.
| Name | Required Columns | Optional Columns | Returns | Scope of query |
|---|---|---|---|---|
| selectTablesSql | table_name | table_schema, table_comment, table_rows | Basic information about all tables in a specific schema. | Database |
| selectViewsSql | view_name, view_definition | view_schema, view_comment | Basic information about all views in a specific schema. | Database |
| selectIndexesSql | index_name, column_name, type, asc_or_desc (docs) | Information about indexes in a specific table. | Single table | |
| selectRowCountSql | row_count | Number of rows in a specific table. | Single table | |
| selectTableCommentsSql | table_name, comments | Comments associated with tables and (optionally) views. Useful if the database driver doesn't return this info or if it's persisted elsewhere. |
Database | |
| selectViewCommentsSql | view_name, comments | Comments associated with views. Optionally defined if selectTableCommentsSql doesn't return view comments. |
Database | |
| selectColumnCommentsSql | table_name, column_name, comments | Comments associated with table columns and (optionally) view columns. Useful if the database driver doesn't return this info or if it's persisted elsewhere. |
Database | |
| selectViewColumnCommentsSql | view_name, column_name, comments | Comments associated with view columns. Optionally defined if selectColumnCommentsSql doesn't return view column comments. |
Database | |
| selectCheckConstraintsSql | constraint_name, table_name, text | Check constraint details of all check constraints, where 'text' is usually the SQL used to create the constraint. These details will be displayed on the table detail pages. | Database | |
| selectViewSql | view_definition | Details of a specific view, usually the SQL used to create the view. These details will be displayed on the view detail pages. | Single view | |
| selectTableIdsSql | table_id, table_name | Unique ID for each table. This is useful for databases (such as DB2) that may give error messages with just table IDs instead of names. | Database | |
| selectIndexIdsSql | index_id, index_name, table_name | Unique ID for each table index. This is useful for databases (such as DB2) that may give error messages with just index IDs instead of names. | Database |
extends directive, specifying another .properties file to be "extended."
Interaction with DB2 through its "type 4 network driver", for example, is almost identical
to the the DB2 "app driver".
db2net.properties therefore has a line that reads
extends=db2 and only includes those configuration options that
deviate from db2.properties.
Another related directive is include.
It "includes" a key=value pair from another .properties file.
The format is include.x=dbtype::key where
include required
mysql)
selectColumnCommentsSql)
dbThreads.
It is used for database drivers whose metadata queries aren't thread safe.
If your driver returns failures like "stream already closed" then you'll need
to specify either dbThreads=1 in your .properties or "-dbThreads 1"
on the command line.