zoukankan      html  css  js  c++  java
  • SchemaSpy:数据库构架文档生产器,以及该软件的部分缺陷修改。提供工具包下载

    (一)SchemaSpy

    官方网站:http://schemaspy.sourceforge.net/

    该软件名称的官方解释为:Graphical Database Schema Metadata Browser

    我的压缩包(SchemaSpy_5.0.0_工具包)

    1. SchemaSpy_5.0.0.jar(原版)
    2. SchemaSpy_5.0.0_mod.jar(我的格式修改版)
    3. SchemaSpy.mht(帮助文档)
    4. jtds-1.2.5.jar(最新 强大、开源、纯java的 sqlserverJDBC驱动)
    5. jd-gui.exe (java class 反编译器)
    6. __SchemaSpy.cmd (我自己写的 启动器,加入 -charset UTF-8 参数)
    7. Dot.java(修改版的)

    (二)常见问题及解决(不断补充中)

    1、中文支持问题  

      该软件有个隐藏参数:-charset UTF-8

      命令选项中加入该参数即可解决文档的乱码问题,但不能解决 Graphviz 图表的中文问题

    2、 软件所依赖的Graphviz版本问题

      该软件运行必须依赖于Graphviz,主要是依赖其中的Dot命令。

      官方的要求是 Graphviz 2.2.1 或 2.4+,否则会出现Dot命令生成图表失败的问题。原因是SchemaSpy自作聪明的判断引擎对默认PNG质量的格式控制,使得内部调用Dot参数 -Tpng命令后添加了质量修饰符":gd"等参数,从而和Graphviz的支持格式不一致。

      修改:最简单的方式是:修改 net.sourceforge.schemaspy.util 下Dot.class 文件。修改反编译后的源文件的 generateDiagram 方法的调用参数:5.0的版本为:

        String[] arrayOfString = { getExe(), "-T" + getFormat() + getRenderer(), paramFile1.toString(), "-o" + paramFile2, "-Tcmapx" };

    修改为

    /* 254 */     String[] arrayOfString = { getExe(), "-Tjpeg", paramFile1.toString(), "-o" + paramFile2, "-Tcmapx" };

    注意:该处我根本就不用png格式,而是jpeg格式!!!!

    3、和“2”相关的问题,因为该软件的最新版本5.0看起来也已经很老了,所有很多的代码和配置不一定适合最新的jdk、db系统,所以,你知道的.......慢慢改呗!

    (三)支持的数据库类型

    TypeDescription
    db2 IBM DB2 with 'app' Driver
    db2net IBM DB2 with 'net' Driver
    udbt4 DB2 UDB Type 4 Driver
    db2zos DB2 for z/OS
    derby Derby (JavaDB) Embedded Server
    derbynet Derby (JavaDB) Network Server
    firebird Firebird
    hsqldb HSQLDB Server
    informix Informix
    maxdb MaxDB
    mssql Microsoft SQL Server
    mssql05 Microsoft SQL Server 2005
    mssql-jtds Microsoft SQL Server with jTDS Driver
    mssql05-jtds Microsoft SQL Server 2005 with jTDS Driver
    mysql MySQL
    ora Oracle with OCI8 Driver
    orathin Oracle with Thin Driver
    pgsql PostgreSQL
    sqlite SQLite
    sybase Sybase Server with JDBC3 Driver
    sybase2 Sybase Server with JDBC2 Driver
    teradata Teradata (requires -connprops)

    基本使用语法

    Commonly used parameters:

     ParameterDescription
      -t databaseType Type of database (e.g. ora, db2, etc.). Use -dbhelp for a list of built-in types. Defaults to ora.
    * -db dbName Name of database to connect to
    * -u user Valid database user id with read access. A user id is required unless -sso is specified.
      -s schema Database schema. This is optional if it's the same as user or isn't supported by your database.
    Use -noschema if your database thinks it supports schemas but doesn't (e.g. older versions of Informix).
      -p password Password associated with that user. Defaults to no password.
    * -ooutputDirectory Directory to write the generated HTML/graphs to
      -dppathToDrivers Looks for drivers here before looking in driverPath in [databaseType].properties. The drivers are usually contained in .jar or .zip files and are typically provided by your database vendor.
      -hq
    -lq
    Generate either higher or lower-quality diagrams. Various installations of Graphviz (depending on OS and/or version) will default to generating either higher or lower quality images. That is, some might not have the "lower quality" libraries and others might not have the "higher quality" libraries.
    Higher quality output takes longer to generate and results in significantly larger image files (which take longer to download / display), but the resultant Entity Relationship diagrams generally look better.

    Parameters marked with '*' are required.

    Less commonly used parameters:

    -gv pathToGraphviz By default SchemaSpy expects the dot executable to be in the PATH environment variable. Use this option to explicitly specify where Graphviz is installed.
    -desc "Schema description" Displays the specified textual description on summary pages. If your description includes an equals sign then escape it with a backslash.
    For example:
    -desc "<a href\='http://schemaspy.sourceforge.net'>SchemaSpy</a>".
    -all Evaluate all schemas in a database. Generates a high-level index of the schemas evaluated and allows for traversal of cross-schema foreign key relationships.
    Use with -schemaSpec "schemaRegularExpression" to narrow-down the schemas to include.
    -schemas"schema1,schema2" Evaluate specified schemas. Similar to -all, but explicitly specifies which schema to evaluate without interrogating the database's metadata. Can be used with databases like MySQL where a database isn't composed of multiple schemas.
    -meta metafile metafile is either the name of an individual XML file or the directory that contains meta files. If a directory is specified then it is expected to contain files matching the pattern [schema].meta.xml.
    For databases that don't have schema substitute database for schema.
    See Providing Additional Metadata for details.
    -connpropspropsfile orkey\=value; Specifies additional properties to be used when connecting to the database. Either specify a .properties file (with key=value entries) or specify the entries directly, escaping the ='s with \= and separating each key\=value pair with a ;.
    -i"tableNamesRegex" Only include matching tables/views. This is a regular expression that's used to determine which tables/views to include. 
    For example: -i "(.*book.*)|(library.*)" includes only those tables/views with 'book' in their names or that start with 'library'.
    You might want to use -desc with this option to describe the subset of tables.
    -I"tableNamesRegex" Exclude matching tables/views. This regular expression excludes matching tables/views from the analysis. Can be used in conjunction with -i.
    -x"columnNamesRegex" Exclude matching columns from relationship analysis to simplify the generated graphs. This is a regular expression that's used to determine which columns to exclude. It must match table name, followed by a dot, followed by column name.
    For example: -x "(book.isbn)|(borrower.address)"
    Note that each column name regular expression must be surround by ()'s and separated from other column names by a |
    Excluded relationships will still show up on detail pages.
    -X"columnNamesRegex" Same as -x but excluded relationships will not show up on detail pages.
    -noviews Exclude all views.
    -ahic Allow HTML IComments.
    Any HTML embedded in comments normally gets encoded so that it's rendered as text. This option allows it to be rendered as HTML.
    -norows Don't query or display row counts.
    -noimplied Don't include implied foreign key relationships in the generated table details.
    -sso Single Sign-On. Don't require a user to be specified with -u to simplify configuration when running in a single sign-on environment.
    -pfp Prompt For Password. Prompts for the password so it doesn't appear on the command line.
    -nohtml Only generate files needed for insertion/deletion of data (e.g. for scripts) and an XML representation of the schema.
    -loglevel Specifies how verbose logging of programmatic flow should be.
    The levels in descending order are:
    • severe (highest - least detail)
    • warning (default)
    • info
    • config
    • fine
    • finer
    • finest (lowest - most detail)

    (四)示例

    You run SchemaSpy from the command line:

         java -jar schemaSpy.jar -t dbType -db dbName [-s schema] -u user [-p password] -o outputDir

    A MySQL example:

      java -jar schemaSpy.jar -t mysql -o library -host localhost -db library -u user -p password

    An MS SQL Server example:

      java -jar schemaSpy.jar -t mssql -db library -host localhost -port 1433 -u user -p password -o library

     我的使用jtds驱动的 MS Sqlserver 实例

    java -jar schemaSpy_5.0.0_mod.jar -charset UTF-8 -t mssql05-jtds -dp .\jtds-1.2.5.jar -db %db% -host localhost -port 1433 -u sa -p sa  -s dbo  -o %db% 
  • 相关阅读:
    时序数据库入门
    MySQL执行计划extra中的using index 和 using where using index 的区别
    ETL的详细解释定义
    六种 主流ETL 工具的比较(DataPipeline,Kettle,Talend,Informatica,Datax ,Oracle Goldengate)
    使用 IntraWeb (37)
    使用 IntraWeb (36)
    使用 IntraWeb (35)
    使用 IntraWeb (34)
    使用 IntraWeb (33)
    使用 IntraWeb (32)
  • 原文地址:https://www.cnblogs.com/jinzhenshui/p/2569400.html
Copyright © 2011-2022 走看看