For a while, I've been using a great little Java-based GUI SQL client called dbVisualizer. It's a nifty little database management tool that -- here's the good part -- supports virtually every database backend under the sun. I use it to manage PostgreSQL and MySQL databases at home and PostgreSQL and Microsoft SQL Server at work, and I can flit between them, using a consistent interface for them all. It's great.

However, being a GUI app, it's a bit slow for when I just want to make one or two small queries, so I went looking for a speedy command-line equivalent today and found HenPlus. Like dbVis, HenPlus is based on Java and JDBC , so it's able to work with a staggering array of backends. It's command-line based, so it should work double-fast, even over a SSH connection.

The one problem I had installing it was with libreadline-java, which is a bridge between Java and GNU readline. (GNU readline is a library that allows tab-completion and command history -- it seriously speeds up command-line work.) I installed the Mandriva Cooker RPM package but it seemed to be missing a couple of files.

My solution was to download and install the source RPM and then:

cd /usr/src/RPM/
rpm -ba SPECS/libreadline-java.spec
[This may give you an error, but leaves behind important files!]
cd BUILD/libreadline-java-0.8.1/
make T_LIBS=JavaReadline
cp libJavaReadline.so /usr/lib/
ln -s /usr/lib/libJavaReadline.so /usr/lib/libJavaReadline.so.0.8.1

also I needed to apply the following patch to /usr/bin/henplus:


--- /usr/bin/henplus.orig   2007-06-14 16:57:51.000000000 +0100
+++ /usr/bin/henplus    2007-06-14 17:36:19.000000000 +0100
@@ -13,6 +13,8 @@
     JAVA=$JAVA_HOME/bin/java
 fi
 
+JAVA=/usr/java/jre1.5.0_07/bin/java
+
 ##------------------
 THISDIR=`dirname $0`
 HENPLUSDIR=$THISDIR/../share/henplus
@@ -26,7 +28,7 @@
 # Modify this, if you installation stores this at a different
 # position.
 LD_LIBRARY_PATH=$THISDIR/../lib:/usr/lib/jni:$LD_LIBRARY_PATH
-CLASSPATH=$CLASSPATH:$THISDIR/../share/java/libreadline-java.jar
+CLASSPATH=$CLASSPATH:$THISDIR/../share/java/libreadline-java.jar:/usr/lib/java/libreadline-java.jar
 
 # you may just throw your own jar files in this dir.
 # (like additional JDBC-drivers, that are not in default

It's working great now