DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
Building Scalable Real-Time Apps with AstraDB and Vaadin
Register Now

Trending

  • How To Check IP Addresses for Known Threats and Tor Exit Node Servers in Java
  • 4 Expert Tips for High Availability and Disaster Recovery of Your Cloud Deployment
  • Using OpenAI Embeddings Search With SingleStoreDB
  • How To Use Pandas and Matplotlib To Perform EDA In Python

Trending

  • How To Check IP Addresses for Known Threats and Tor Exit Node Servers in Java
  • 4 Expert Tips for High Availability and Disaster Recovery of Your Cloud Deployment
  • Using OpenAI Embeddings Search With SingleStoreDB
  • How To Use Pandas and Matplotlib To Perform EDA In Python
  1. DZone
  2. Data Engineering
  3. Databases
  4. SchemaSpy - Excellent Database Graphs for Free!

SchemaSpy - Excellent Database Graphs for Free!

Rainer Eschen user avatar by
Rainer Eschen
·
Jul. 10, 08 · News
Like (0)
Save
Tweet
Share
29.03K Views

Join the DZone community and get the full member experience.

Join For Free

A lot of Java projects have quite complex database schemas in the backend. Although, using object-relational mapping it can be useful to have a deeper understanding of such a schema, e.g. when writing CRUD tests.

For me the visualization of table relations is quite important, besides the table attributes. There are a lot of entity relationship modeling tools out there, doing a pretty good job. But, most of them are also quite expensive.

I did a search for something OpenSource and found some tools from the mySQL community. Although, these should support Oracle I had problems to get things running. In one case only a pro version allowed to do an analysis for a remote database installation (what is the normal case for Oracle schemas ;-)).

Well, in the end I found a German article by Joachim Uhl that confirmed some of my experiences and gave some useful tips to get a productive solution. He prefers SchemaSpy, a Java-based commandline tool, and also develops a Java-based GUI application for it.

Although, "nominated" in 2006, SchemaSpy seems to be still the best OpenSource tool for schema documentation. The list of databases, that are supported, is impressive. My first tests with SchemaSpyGUI, SchemaSpy and GraphViz for Windows, the tool that generates the cool dependency graphs, are promising.

 

SchemaSpy Online Example
Fig. 1: SchemaSpy Example for a Dependency Graph

 

There's an online example for a first look [Fig. 1]. If you click on the "Relationships" tab you get the first of three possible graphical presentations. Use the checkboxes for presentation changes. There's also an "Anomalies" tab that may helps to find design issues in the schema.

Installation

Before you start SchemaSpyGUI the first time, SchemaSpy and GraphViz already have to be installed on your system. GraphViz is the only guy who not resides in Javaland, so you need a platform-dependent installation instead. I tested all this on Windows XP.

The downloads:

  • SchemaSpyGUI
  • SchemaSpy
  • GraphViz (Windows)

SchemaSpyGUI delivers a simple ZIP archive you can extract to your program files directory. SchemaSpy delivers a production-ready JAR, that you may put into the existing SchemaSpyGUI directory, too. GraphViz delivers a full-blown Windows installer. There's nothing special here. SchemaSpyGUI only needs the dot.exe in the environment path, that is done automatically by the installer.

Configuration

If you start SchemaSpyGUI the first time, all fields are empty. The form is pretty simple, but can only manage one profile at the moment (use buttons "Save Parameters" and "Load Parameters" for this). The profile is saved in the "sSpyGUIini.xml", so you may create a batch hack to create a schema presentation for more than one database automatically.

 

SchemaSpyGUI - Required Parameters
Fig. 2: SchemaSpyGUI - Required Parameters for Database Access

 

The "Required Parameters" defines which database to use and where the JDBC driver and SchemaSpy can be found [Fig. 2]. For the Oracle database I used

  • DB Type: orathin (all other DB parameters as usual)
  • Path to DB driver: \com\oracle\jdbc\ojdbc14\10.2.0.1.0\ojdbc14-10.2.0.1.0.jar from our Maven2 repository
  • Path to SchemaSpy: \SchemaSpyGUI\schemaSpy_3.1.1.jar (as suggested above)

 


Fig. 3: SchemaSpyGUI - Optional Parameters for Output and Schema Selection

 

I also set the "Optional" parameters on the right [Fig. 3]. The "Output directory" defines the place where you can find "index.html" and all other files after processing. I also set the "Schema to explore". It is also possible to be more fine-grained using regular expressions on tables or attributes.

Don't forget to click on "Save Parameters" in the end. If you start SchemaSpyGUI the next time you click on "Load Parameters" and everything is set - except from the database password ;-).

Usage

All parameters are set. So, we can start to create the schema presentation. For this click on "Start SchemaSpy" [Fig. 3]. The log window shows messages from SchemaSpy during the processing. When everything is done click on "Show Schema Output" to have a look at the results in your Web browser.

Database

Published at DZone with permission of Rainer Eschen. See the original article here.

Opinions expressed by DZone contributors are their own.

Trending

  • How To Check IP Addresses for Known Threats and Tor Exit Node Servers in Java
  • 4 Expert Tips for High Availability and Disaster Recovery of Your Cloud Deployment
  • Using OpenAI Embeddings Search With SingleStoreDB
  • How To Use Pandas and Matplotlib To Perform EDA In Python

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com

Let's be friends: