As a DBA, I have been asked many times to provide an ER diagram for an application schema. There are many tools that can do the job, mostly expensive CASE tools which have reverse engineering capabilities. There are also some rather exotic freeware tools which are largely unsupported and difficult to find.
Fortunately, there is a software tool ideal for drawing ER diagrams, called GraphViz. GraphViz is a general tool for drawing all kinds of graphs. It was created by AT&T Research specifically for graph drawing and it uses so called "dot" language. The tool itself is available on the following web page: http://graphviz.org
The tool uses rather simple language called "dot", which would not be a problem to generate by PHP but the task can be simplified even further. It turns out that PHP Extension and Application Repository, known as "PEAR" contains a package with PHP bindings for GraphViz. The home page for this package is http://pear.php.net/package/Image_GraphViz. In order to use GraphViz, one has to install the GraphViz package, highly portable and available for many platforms, both MS Windows and Linux, among others. Installing the PHP bindings for GraphViz with PEAR installer is also a breeze:
#> pear install Image_GraphViz
downloading Image_GraphViz-1.2.1.tar ...
Starting to download Image_GraphViz-1.2.1.tar (Unknown size)
........done: 23,040 bytes
install ok: channel://pear.php.net/Image_GraphViz-1.2.1
#>
Now, let's see the basic elements of the "dot" language:
Continue reading "Drawing ER Diagrams For Oracle Schemas With PHP And GraphViz" »