If you’re a database manager, and your database runs on multiple platforms, your job is pretty complex. Ensuring the consistency of a schema under active development across different operating systems is a tedious task. But take heart – a tool called SchemaCrawler may make your job easier.
SchemaCrawler comprises two components: a library for obtaining database metadata, and a set of command-line tools for outputting a database schema as plain text. Because it’s written in Java, it runs on many hardware and operating system platforms. It also works against many database schemas.
The Java library is convenient for Java developers because it lets them avoid worrying about managing database connections or error handling. The command-line toolkit lets administrators and developers see what’s different among versions of a database, and lets users search through a schema, in a way similar to grep.
SchemaCrawler lets you write scripts against your database using JavaScript. It provides your database schema to the JavaScript context as objects, and provides a live database connection. This lets you do things like write a script to construct and execute a complicated SQL SELECT command, for example, or drop selected tables.
Boston-based Sualeh Fatehi started the SchemaCrawler project about 10 years ago when he worked for a software company that supported a product on multiple database platforms, and he had to ensure that the schemas were consistent across the systems. Since then he has used the software to ensure schema integrity at every company that he has worked for as an integral part of the organization’s build and deploy process.
Fatehi says he uses Eclipse to write the SchemaCrawler code, and Apache Maven as the build and management system. Maven also generates the SchemaCrawler web site. Fatehi listed the project on SourceForge.net to take advantage of its development and promotion tools. He also promotes the project with release notifications on freshmeat. “I am also active on Google groups, StackOverflow and so on, where developers ask questions, and have helped people find solutions to their problems using SchemaCrawler. I love when people use and appreciate my work, and also provide feedback and ideas.”
In future versions, Fatehi hopes to make differences between two databases available programmatically. “If the database differences could be shown in a user interface, it would bring SchemaCrawler into play with expensive commercial alternatives, proving the power of open source.” If you’d like to help achieve that goal, send Fatehi e-mail.