Posted by nick @ 21:31 on December 7th 2006

HTML documentation for a database schema

table Some time ago I was looking for a “quick and dirty” way of generating HTML documentation of one of my clients’ database schema. I didn’t need an ER diagram – just a list of tables to insert into a word document. At that time TOAD for DB2 did not exist, so I could not use it for my purpose.

Eventually, I ended up creating a simple solution for that simple problem, using a SQL script fetching information from the database catalog and an XSL template to transform its output into HTML, similar to this.

tbldoc is just a bunch of SQL scripts, XSD and XSL files, and a sample CSS style sheet that all serve a single purpose: to create simple documents describing tables and views in a database.

The information that is extracted from a database system catalog contains description of each column of each (specified) table and view. That information is saved as an XML document that conforms to the provided schema. An XSL transformation can then be applied to that XML in order to produce an HTML representation of the catalog data.

Internet Explorer and Firefox can perform transformation of XML documents “on the fly”, so opening XML file in one of those browsers presents a nicely formatted database catalog. Here is a sample.

The HTML file can be viewed online, copied and pasted into a word processing program, or opened directly by such program (e.g. Microsoft Word).

Database system catalog contents differ from vendor to vendor and from
version to version. For this reason the SQL query used to extract catalog
information would be different in each case. For now I only have a script for DB2 UDB v8.

If you think it can be useful for you please download the archive and freely use the tool.

6 Comments »

  1. Hi,

    Thanks for sharing this tool.
    The archive that you provided here is corrupted, I couldn’t be able to extract the files.

    Thanks,
    Ramesh

    Comment by Ramesh — January 17, 2007 @ 01:19

  2. The archive seems to be ok, actually. WinZip handles it without problems. Also please try “gzip -d -c | tar xvf -“.

    Comment by nick — January 17, 2007 @ 08:43

  3. [...] datori.blog published their tool for producing HTML documentation for a database schema in DB2 UDB. This is a lot nicer to look at than typical web representations of tables, isn’t it? [...]

    Pingback by Pythian Group Blog » Log Buffer #28: a Carnival of the Vanities for DBAs — March 9, 2007 @ 21:49

  4. [...] Neat example of XML and XSL with a DB2 twist July 21st, 2011 | admin | 0 Comments » datori.blog: HTML documentation for a database schema [...]

    Pingback by Neat example of XML and XSL with a DB2 twist ~ Daily Life Health Beauty About The All New Tips — July 21, 2011 @ 10:55

  5. [...] published their tool for producing HTML documentation for a database schema in DB2 UDB. This is a lot nicer to look at than typical web representations [...]

    Pingback by Log Buffer #28: A Carnival of the Vanities for DBAs — February 5, 2013 @ 12:16

  6. very good idea, thank you very much for share

    Comment by bo,liu — April 15, 2013 @ 08:43

RSS feed for comments on this post. TrackBack URI

Leave a comment