VisualSQL is a JDBC client for databases. You can send SQL queries and see the result in a table. It is released under GPL thus, the sources are available.
To install the software, go the directory where you downloaded the archive and type java -jar vsql-0.5.jar on the command line.
Please read the documentation in the doc/ directory for full installation explanation (regarding JDBC drivers).