(1) schemaspy
Http://schemaspy.sourceforge.net/
The software name is officially interpreted as: Graphical database schema metadata Browser
My compressed package (schemaspy_5.0.0 _ Toolkit ):
- Schemaspy_5.0.0.jar (original version)
- Schemaspy_5.0.0_mod.jar (my modified format)
- Schemaspy. MHT (help document)
- Jtds-1.2.5.jar (the latest powerful, open-source, pure Java sqlserverjdbc driver)
- Jd-gui.exe (Java class anti-compiler)
- _ Schemaspy. CMD (I write the starter, add-charset UTF-8 parameters)
- Dot. Java (Modified Version)
(2) common problems and solutions (continuously supplemented)
1. Chinese support problems
The software has a hidden parameter:-charset UTF-8
This parameter is added to the Command Option to solve the document Garbled text problem, but it cannot solve the Chinese problem of graphviz charts.
2. graphviz version on which the software depends
The running of the software must depend on graphviz, mainly on the dot command.
The official requirement is graphviz 2.2.1 or 2.4 +. Otherwise, the dot command fails to generate the chart. The reason is that schemaspy uses a smart judgment engine to control the default PNG quality format, so that parameters such as the Quality modifier ": Gd" are added after the dot parameter-tpng command is called internally, the format is inconsistent with that supported by graphviz.
Modify: The simplest way is to modify the dot. Class file under net. SourceForge. schemaspy. util. Modify the call parameter of the generatediagram method of the decompiled source file: Version 5.0 is:
String [] arrayofstring = {getexe (), "-T" + getformat () + getrenderer (), paramfile1.tostring (), "-o" + paramfile2, "-tcmretrial "};
Change
/*254*/String [] arrayofstring = {getexe (), "-tjpeg", paramfile1.tostring (), "-o" + paramfile2, "-tcmretrial "};
Note: I do not need to use PNG format, but JPEG format !!!!
3. Problems related to "2", because the latest version of the software 5.0 also looks very old, all a lotCodeAnd the configuration is not necessarily suitable for the latest JDK and DB systems, so, you know ...... change it slowly!
(3) supported database types
Type |
Description |
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) |
Basic syntax
Commonly used parameters:
|
Parameter |
Description |
|
-TDatabasetype |
Type of Database (e.g. ora, DB2, etc.). Use-Dbhelp For a list of built-in types. defaultsOra . |
* |
-DBDbname |
Name of database to connect |
* |
-UUser |
Valid Database User ID with read access. A user ID is required unless-Sso Is specified. |
|
-SSchema |
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 ). |
|
-PPassword |
Password associated with that user. defaults to no password. |
* |
-OOutputdirectory |
Directory to write the generated HTML/graphs |
|
-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 -SCSI |
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:
-GvPathtographviz |
By default schemaspy expects the dot executable to be in the path environment variable. Use this option to explain icitly specify where graphviz is installed. |
-Desc"Schema description" |
Displays the specified textual description on summary pages. If your description already des 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-Schemaspec"Schemaregularexpression" To narrow-down the schemas to include. |
-Schemas"Schema1, schema2" |
Evaluate specified schemas. Similar-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. |
-MetaMetafile |
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. |
-ConnpropsPropsfileOrKey \ = value; |
Specifies additional properties to be used when connecting to the database. either specify. properties file (with key = value entries) or specify the entries directly, escaping the ='s with \ = and separating each key \ = value pair with; . |
-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 .*)" Except des 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-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() 'S and separated from other column names by| . Excluded relationships will still show up on detail pages. |
-X"Columnnamesregex" |
Same-X But excluded relationships willNotShow up on detail pages. |
-Noviews |
Exclude all views. |
-Ahic |
ALlowHTMLINCOmments. 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 |
SIngleSIGN-ON. don't require a user to be specified-U To simplify configuration when running in a single sign-on environment. |
-PFP |
PRomptFOrPAssword. 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 shocould be. The levels in descending order are:
Severe (Highest-least detail)
Warning (Default)
Info
Config
Fine
Finer
Finest (Lowest-most detail)
|
(4) Example
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
|
My MS sqlserver instance with jtds driver
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 %