SchemaSpyTutorial V1.0
SchemaSpyTutorial V1.0
Introduction
Purpose
The purpose of this document is to quickly create diagrams using SchemaSpy, Graphviz and oracle jdbc drivers
(classes12.zip).
Scope
This document only communicates the steps involved in creating diagrams and editing diagram connection arrows
(relationships).
Definitions, Acronyms, and Abbreviations
$DIR
2.
Downloading SchemaSpy
2.1
2.2
Click downloads from the left navigation and click the download link after the text
Looking for the latest version?
2.3
3.
Downloading GVGraphics
3.1
3.2
Click the link under current stable release that has the extension .zip
Ex: graphviz-2.38.zip
3.3
3.4
3.5
Right click the zip and click extract all and click extract. Record the path.
Ex: $DIR\Graphiz
4.
4.1
If you have CDAnet workspace setup class12.zip can be found at the following path:
C:\workspace\cdanet\commonLib-3rdPartyJars\Oracle\Oracle10g\
NOTE:
You just need the folder and its contents so this can be given via email etc
This can also be downloaded from the web.
4.2
This is found in
\cdanet\commonLib-3rdPartyJars\Oracle
Under the CDAnet_WAS6 repository.
4.3
Save the folder if downloaded to $dir or record the path like the one in 4.1
Ex: $DIR\Oracle10g\
5.
Running SchemaSpy
5.1
Assumptions
5.2
5.2.1
Database Host
Ex: bcisi.atl.bluecross.ca
5.2.2
Database Port
Ex: 1521
5.2.3
Database Name
Ex: BCIS
5.2.4
5.2.5
5.2.6
Desired output
Ex: $DIR\Diagrams\MyFirstDiagrams
5.3
Using the information collected from 3.5, 4.3 and 5.2 replace the CAPITAL words with
recorded information or where the mentioned numbers are listed between %.
(use notepad to initially create by copying the below statement and following above statements)
java -jar $DIR\SchemaSpy.jar -dp "%3.5%" -t orathin -host HOST -port PORT -db DATABASENAME -s
SCHEMA -u USERNAME-p PASSWORD -o "DESIRED_OUTPUT_DIRECTORY" -gv "3.5"
Ex: java -jar C:\Users\00000000\Downloads\schemaSpy_5.0.0.jar -dp "C:\workspace\cdanet\commonLib3rdPartyJars\Oracle\Oracle10g\classes12.zip" -t orathin -host bcisi.atl.bluecross.ca -port #### -db BCISI -s
CDANET -u **** -p **** -o "C:\Users\00000000\Downloads\DatabaseDiagramsSchemaSpy" -gv
"C:\Users\00004234\Downloads\graphviz-2.38\release"
5.4
5.5
Copy the created statement from 5.3 and paste into command window (right click and
paste) and hit ente.
Note: depending on what database you are accessing or how many tables you are
hitting this may take some time. Do not worry if it seems to hang.
5.6
Navigate to your output directory and the tables and diagrams will be there.
Path specified in 5.3.6
6.
6.1
6.2
Open gvedit.exe
6.3
In gvedit open the .dot file associated to the diagram you want to edit.
Ex:
Diagram: relationships.real.large.png
Dot File : relationships.real.large.dot
6.4
For convenience click window at the top and then click tile.
The left shows the graph and the right shows what the program reads to create the graph.
6.5
Scroll to the very bottom of the right window and notice the lines that look like :
"CDANET_TRANS":"REQUEST_ID":w -> "CDANET_MESSAGE":"MESSAGE_ID":e
[arrowhead=none dir=back arrowtail=crowodot];
6.6
These are the lines that make the arrows on the diagrams.
Replace TABLE_NAME and COLUMN_NAME with your desired tables/columns
(they must be in the diagram already)
"TABLE_NAME":"COLUMN_NAME":w -> "TABLE2_NAME":"COLUMN2_NAME":e
[arrowhead=none dir=back arrowtail=crowodot];
To Remove a relationship simply delete the line associated to it.
Valid arrowtail types can be found at :
http://www.graphviz.org/doc/info/attrs.html#k:arrowType
(Feel free to explore the dot file since color changes/styles can be changed here as well but this is out of
scope for this tutorial)
6.7
Click Graph at the top and then click layout and notice the changes.
NOTE:
If changes are not shown in png go to Graph>Settings and under output filename click the button with
and browse to / select the png for the output. (you can create a blank png if the original got deleted and
6.9