JDBC/Swing query tool, available from Source Forge
It’s optimized for MySql, but also has some MS-SQL support, through a layer of abstraction aimed at providing generalized database capabilities.
Java source code only, licensed under the GPL. A brief README accompanies.