How to add drivers to SQuirreLSQL.app

SQuireL SQL on OSX with Oracle driversIf you’re a SQuirreL SQL fan like me, and you use a Mac, you probably also want to know how to add a driver to the OSX version of the application. Most people just point to an external jar file, but you can also add drivers to the application bundle.  There’s not much to it, but it took me some time to discover that I actually had to edit the plist file in the bundle after adding the driver.

As you can see on the left, my SQuireLSQL.app now comes with the Oracle OCI and Thin driver built in, and because they are part of the application bundle, I can’t wreck my installation by misplacing jarfiles or reconfiguring classpaths. Nice.

If you want to drivers to your SQuireLSQL.app yourself, here’s what you need to do:

  1. Download  and unpack SQuirreL SQL for OSX.
  2. Verify that is starts up, and that your drivers are missing. Close SQuirreL again.
  3. Right-click on SQuireLSQL.app and select “show package contents”.
  4. Browse to the Contents/Resources/Java/lib folder. Copy the jar file of your driver into this folder (I used ojdbc14.jar in this example)
  5. Double-click the Contents/Info.plist file. The default plist editor will show up.
  6. In the plist editor, find the “Information Property List”/ Java/ClassPath property.
  7. At the end of the value in this property, add a colon, and a reference to your copied library. In our example (see step 4) I had to add “:$JAVAROOT/lib/ojdbc14.jar”, excluding quotes, but including the colon (see other libraries in the path and use them as examples.
  8. Save the plist file, and double-click SQuireLSQL.app. Your driver should now have a blue checkmark next to it.

Please note that now you’ve added proprietary drivers to the bundle, you can no longer freely distribute it. Usage and distribution of your version of SQuireLSQL.app is now “contaminated” by the licences of the driver(s) you installed.

Happy SQL-ing!

About these ads

11 Responses to How to add drivers to SQuirreLSQL.app

  1. Rob Manning says:

    That is quite painful. The classpath in the Info.plist is a requirement for using Apple’s JavaApplicationStub launcher. Just a heads up – we may be re-doing the launch mechanism for the next major release (3.0) for auto-update and this may have a positive effect on how the driver jars get added to the classpath. Stay tuned!

    Rob

  2. rolfje says:

    Hi Rob,

    Just checked out the 3.0 version from CVS HEAD. I must say the directory structure and the ant build file feel somewhat convoluted, I had to manually fix he buildpath on my Mac Eclipse installation to get it to work.

    The look and feel of SQuireLSQL 3.0 is a lot better on my Mac, I will definetely upgrade as soon as it is GA. I’m tinkering with the error log dialog, because black-on-red is really hard to read and I hope to be able to make the coloring a bit more sensible. I’ll send you guys the patch as soon as I’ve figured that out.

    There seems to be an error in Version.java. Although it compiles with JDK 1.5, it pops up an error message that it does not support it. I made the check less strict (allowing JDK 1.5) and it works fine.

    Thanks for providing a great (and free!) SQL client,
    Rolf

  3. Rob Manning says:

    Hi Rolf,

    The build structure was established before my arrival. I have tried to preserve it, even though I would agree that it should probably be overhauled. For now, it does the job. What did you have to change?

    For version 3.0, we are using some APIs that are only available in 1.6 which breaks compatibility with 1.5. So the version of the JRE is expected to be 1.6 and there are several places where this check is made. I can’t explain how it’s working for you without exceptions.

    Patches are always welcome and I know the problem you are working on has been put forward by a feature request, so I know other people would appreciate it as well :

    https://sourceforge.net/tracker2/index.php?func=detail&aid=1366521&group_id=28383&atid=393417

    Rob

  4. rolfje says:

    Hi Rob,

    I only changed the coloring in MessagePanel so that errors now have dark red text to a white background. It only took 2 small changes, I’ve sent the patch to Gerd, and he applied it.

    I checked and you are right, the source can not be compiled without JDK 1.6. Eclipse lets me start the software with errors, I overlooked the little red cross in the GUIdesktopContainer package.

    For now I’m going to figure out why the ant buildscript is not working for me, and then check if i can have SquireLSQL start with JDK 1.6, and Eclipse with JDK 1.5, without switching my environment settings every time.

    It would also be nice if I could figure out a way to make the message colors configurable, but given my experience with Swing, I wouldn’t get my hopes up :-)

    Thanks again for a great piece of free software!

  5. Rob Manning says:

    The latest snapshot removes the need to update the Info.plist (it no longer has a hard-coded classpath in it). The classpath is built dynamically when SQuirreL is launched using the squirrel-sql.sh launch script. This change had to be made to launch the updater application before SQuirreL starts. But the side effect is now you could just drop the driver jars in $JAVAROOT/lib and SQuirreL should pick them up when it is started.

    You should be able to start eclipse with 1.5 (see eclipse.ini or with command-line args) and then add an installed JRE to eclipse and use it in the SQuirreL project.(I haven’t tried this yet, but it seems like it should work – although debugging SQuirreL as an application might be wonky given that the eclipse JVM is 1.5 and the SQuirreL JVM is 1.6. Any idea when support will be added in Eclipse for Apple’s 64-bit 1.6 JRE ?

    Rob

  6. rolfje says:

    That’s great news! Together with the new look and the dynamic classpath, SQuireL will improve a lot for OSX users.

    I haven’t tried configuring Java 1.6 for a project while running eclipse on 1.5, I can imagine that it would give some problems but who knows.

    Support for 64 bit 1.6 JRE is coming in Eclipse 3.5, milestone 4:

    http://rolfje.wordpress.com/2008/12/28/eclipse-341-osx-and-java-16/#comment-541

  7. K. Jusupov says:

    Somehow squirrelsql v3 is not launching (double-click in Finder or launch from Quicksilver) on my mac os x (10.5.6), BUT works fine when I run /Applications/SQuirreLSQL.app/Contents/MacOS/squirrel-sql.sh

    synack @ deimos [ Resources ] java -version
    java version “1.6.0_07″
    Java(TM) SE Runtime Environment (build 1.6.0_07-b06-153)
    Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_07-b06-57, mixed mode)

    Logs captured/seen in Console:
    Monday3/2/09 12:13:45 PM com.apple.launchd[103] ([0x0-0x166166].net.sourceforge.squirrel_sql[3946]) Exited with exit code: 1
    Monday3/2/09 12:14:24 PM [0x0-0x167167].net.sourceforge.squirrel_sql[3951] [JavaAppLauncher Error] CFBundleCopyResourceURL() failed loading MRJApp.properties file
    Monday3/2/09 12:14:24 PM [0x0-0x167167].net.sourceforge.squirrel_sql[3951] [JavaAppLauncher] application launched with ppc-thin application stub. Using native application stub instead.
    Monday3/2/09 12:14:24 PM [0x0-0x167167].net.sourceforge.squirrel_sql[3951] [JavaAppLauncher Error] CFBundleCopyResourceURL() failed loading MRJApp.properties file
    Monday3/2/09 12:14:24 PM [0x0-0x167167].net.sourceforge.squirrel_sql[3951] [LaunchRunner Error] No main class specified
    Monday3/2/09 12:14:24 PM [0x0-0x167167].net.sourceforge.squirrel_sql[3951] [JavaAppLauncher Error] CallStaticVoidMethod() threw an exception
    Monday3/2/09 12:14:24 PM [0x0-0x167167].net.sourceforge.squirrel_sql[3951] Exception in thread “main” java.lang.NullPointerException
    Monday3/2/09 12:14:24 PM [0x0-0x167167].net.sourceforge.squirrel_sql[3951] at apple.launcher.LaunchRunner.run(LaunchRunner.java:112)
    Monday3/2/09 12:14:24 PM [0x0-0x167167].net.sourceforge.squirrel_sql[3951] at apple.launcher.LaunchRunner.callMain(LaunchRunner.java:50)
    Monday3/2/09 12:14:24 PM [0x0-0x167167].net.sourceforge.squirrel_sql[3951] at apple.launcher.JavaApplicationLauncher.main(JavaApplicationLauncher.java:61)
    Monday3/2/09 12:14:24 PM [0x0-0x167167].net.sourceforge.squirrel_sql[3951] at apple.launcher.JavaApplicationLauncher.main(JavaApplicationLauncher.java:61)
    Monday3/2/09 12:14:24 PM com.apple.launchd[103] ([0x0-0x167167].net.sourceforge.squirrel_sql[3951]) Exited with exit code: 1

  8. monty241070 says:

    Over the years I’ve learnt how to add drivers, but it is painful. In our own query tool from Invantive we have a discover module which just searches various sources for available databases. Oracle has tnsnames.ora plus something DNS-like, when you have the SQL server browser service running, you can discover the SQL Server databases in your subnet, etc. I would enjoy it when Squirrel SQL would get such features too.

    • rolfje says:

      I haven’t used SquirelSQL in years. Currently working with SequelPro, great tool, but no Oracle (the database) support.

      I’m also planning to ditch MySQL in favor of MariaDB soon, as Oracle (the company) is pretty evil and aggressive in their marketing and licensing. Ugly.

      I don’t mind paying for good software, but I don’t like the way Oracle goes about their business.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 30 other followers