visualizing a database structure with schemaspy

14
Visualizing a Database Structure with SchemaSpy Albert Guo [email protected]

Upload: guo-albert

Post on 23-Jun-2015

7.435 views

Category:

Technology


5 download

TRANSCRIPT

Page 1: Visualizing a Database Structure with SchemaSpy

Visualizing a Database Structure with SchemaSpyAlbert Guo

[email protected]

Page 2: Visualizing a Database Structure with SchemaSpy

Agenda

• Introduction

• SchemaSpy Parameters

• SchemaSpy Support Database Type

• Database Document Generation Process – command line

• Database Document Generation Process – ant build script

• My output

Page 3: Visualizing a Database Structure with SchemaSpy

Introduction

• SchemaSpy can be a valuable asset in maintaining and publishing these models.

• Like Javadoc for Java source code, SchemaSpy provides an accurate, up-to-date view of the database structure, generated automatically from the actual database.

• As an automated tool, SchemaSpy incurs very little cost to set up and virtually no cost to maintain—the diagrams are automatically updated as the database schema evolves.

• This alone is a valuable time-saver for both development and maintenance teams.

• http://schemaspy.sourceforge.net/

Page 4: Visualizing a Database Structure with SchemaSpy

SchemaSpy Parameters

Parameter Description

-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

-s schema Database schema (optional if the same as user or isn't supported by your database)

-p password Password associated with that user. Defaults to no password.

* -o outputDirectory Directory to write the generated HTML/graphs to

* denotes required parameter.Please go to here, http://schemaspy.sourceforge.net/, to get full parameter list. * denotes required parameter.Please go to here, http://schemaspy.sourceforge.net/, to get full parameter list.

Page 5: Visualizing a Database Structure with SchemaSpy

SchemaSpy Support Database Type

Type Description

db2 IBM DB2 with the 'App' Driver

db2net IBM DB2 with the 'Net' Driver

firebird Firebird

hsqldb HSQLDB Server

mssql Microsoft SQL Server

mysql MySQL

ora Oracle with OCI8 Driver

orathin Oracle with Thin Driver

pgsql PostgreSQL

sybase Sybase Server with JDBC3 Driver

sybase2 Sybase Server with JDBC2 Driver

udbt4 DB2 UDB Type 4 Driver

Page 6: Visualizing a Database Structure with SchemaSpy

Database Document Generation Process – command line

Database documentDatabase document

Command lineCommand line

Retrieve database info.Retrieve database info.

generate generate

Page 7: Visualizing a Database Structure with SchemaSpy

Database Document Generation Process – command line

• A MySQL example:

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

– will create a series of files in the library directory that give the details of the schema in the database library.

• An MS SQL Server example:

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

– does the same thing as the MySQL example, but specifies an mssql database type with MS SQL Server-specific database connection parameters.

Page 8: Visualizing a Database Structure with SchemaSpy

Database Document Generation Process – ant build script

Database documentDatabase document

Retrieve database info.Retrieve database info.

generate generate

Page 9: Visualizing a Database Structure with SchemaSpy

Database Document Generation Process – ant build script

Assign parameter valuesAssign parameter values

Page 10: Visualizing a Database Structure with SchemaSpy

Database Document Generation Process – ant build script

Integrate command line into ant build scriptIntegrate command line into ant build script

Page 11: Visualizing a Database Structure with SchemaSpy

Database Document Generation Process – ant build script

Just type in ant to generate database schema documentJust type in ant to generate database schema document

Page 12: Visualizing a Database Structure with SchemaSpy

My output

Page 13: Visualizing a Database Structure with SchemaSpy

My output – cont.

Page 14: Visualizing a Database Structure with SchemaSpy

My output – cont.