
  SchemaSpy Database Types

   One goal of SchemaSpy is to support a wide range of JDBC-complaint
   databases. It uses the concept of "database types", as specified by
   .properties files, to achieve that goal. Out of the box SchemaSpy supports
   a multitude of databases. If your database isn't currently supported or
   needs to be customized then continue reading.

   For SchemaSpy to support your database it must:

    1. Have JDBC drivers available
    2. The JDBC drivers must provide JDBC metadata

   The vast majority of relational databases have JDBC drivers that provide
   appropriate metadata.

  Database Type .properties Files

   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 name

  Basic entries

   description
   Simple description of the type of database.

   driver
   The full name of the driver class that provides the required JDBC
   services. This class name is provided by the database driver vendor. Use
   the -dp (driver path) command-line option to point to the .jar or .zip
   that contains this class.

   connectionSpec
   The format of the connection spec is defined by the database driver
   vendor. It usually has a format similar to the one used for MySQL:

   jdbc:mysql://<host>/<db>

   The names surrounded by < and > are required by the driver vendor and will
   become required parameters on the SchemaSpy command line. Those command
   line values will be substituted into the connection spec before it is used
   to connect to the database.

   host and db
   These will vary for each type of database and provide documentation for
   the names surrounded by < and > in 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.

  Custom SQL

   The remaining entries in the .properties file are not required for most
   databases. They're typically used to provide functionality that either
   isn't provided by the JDBC metadata services or when those services are in
   some way inappropriate (performance, incorrect results, etc.).

   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           | Req'd Column(s)  |     Returns      |Scope of|
   |                         |                  |                  | query  |
   |-------------------------+------------------+------------------+--------|
   |                         |index_name,       |Information about |Single  |
   |selectIndexesSql         |column_name, type,|indexes in a      |table   |
   |                         |asc_or_desc (docs)|specific table.   |        |
   |-------------------------+------------------+------------------+--------|
   |selectRowCountSql        |row_count         |Number of rows in |Single  |
   |                         |                  |a specific table. |table   |
   |-------------------------+------------------+------------------+--------|
   |                         |                  |Comments          |        |
   |                         |                  |associated with   |        |
   |                         |                  |tables. Useful if |        |
   |                         |table_name,       |the database      |        |
   |selectTableCommentsSql   |comments          |driver doesn't    |Database|
   |                         |                  |return this info  |        |
   |                         |                  |or if it's        |        |
   |                         |                  |persisted         |        |
   |                         |                  |elsewhere.        |        |
   |-------------------------+------------------+------------------+--------|
   |                         |                  |Comments          |        |
   |                         |                  |associated with   |        |
   |                         |                  |table columns.    |        |
   |                         |table_name,       |Useful if the     |        |
   |selectColumnCommentsSql  |column_name,      |database driver   |Database|
   |                         |comments          |doesn't return    |        |
   |                         |                  |this info or if   |        |
   |                         |                  |it's persisted    |        |
   |                         |                  |elsewhere.        |        |
   |-------------------------+------------------+------------------+--------|
   |                         |                  |Check constraint  |        |
   |                         |                  |details of all    |        |
   |                         |                  |check constraints,|        |
   |                         |                  |where 'text' is   |        |
   |                         |constraint_name,  |usually the SQL   |        |
   |selectCheckConstraintsSql|table_name, text  |used to create the|Database|
   |                         |                  |constraint. These |        |
   |                         |                  |details will be   |        |
   |                         |                  |displayed on the  |        |
   |                         |                  |table detail      |        |
   |                         |                  |pages.            |        |
   |-------------------------+------------------+------------------+--------|
   |                         |                  |Details of a      |        |
   |                         |                  |specific view,    |        |
   |                         |                  |usually the SQL   |        |
   |selectViewSql            |text              |used to create the|Single  |
   |                         |                  |view. These       |view    |
   |                         |                  |details will be   |        |
   |                         |                  |displayed on the  |        |
   |                         |                  |view detail pages.|        |
   |-------------------------+------------------+------------------+--------|
   |                         |                  |Unique ID for each|        |
   |                         |                  |table. This is    |        |
   |                         |                  |useful for        |        |
   |                         |table_id,         |databases (such as|        |
   |selectTableIdsSql        |table_name        |DB2) that may give|Database|
   |                         |                  |error messages    |        |
   |                         |                  |with just table   |        |
   |                         |                  |IDs instead of    |        |
   |                         |                  |names.            |        |
   |-------------------------+------------------+------------------+--------|
   |                         |                  |Unique ID for each|        |
   |                         |                  |table index. This |        |
   |                         |                  |is useful for     |        |
   |                         |index_id,         |databases (such as|        |
   |selectIndexIdsSql        |index_name,       |DB2) that may give|Database|
   |                         |table_name        |error messages    |        |
   |                         |                  |with just index   |        |
   |                         |                  |IDs instead of    |        |
   |                         |                  |names.            |        |
   +------------------------------------------------------------------------+

  Reusing Configurations

   For those instances where you have two almost identical configurations you
   can use the extends entry, 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.

  Single-Threaded Drivers

   There's one remaining database configuration entry named 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.
