Don’t forget the drivers!

I’ve been reading Matt Woodward’s entry Setting Up a Mac for ColdFusion Development and I’ve noticed he’s missed one minor, but kind of important thing – in order for ColdFusion to be able to connect to datasources that use the downloaded drivers, you actually need them findable in the ColdFusion classpath. So, Matt’s recommendation that you place your drivers somewhere convenient isn’t quite right.

My personal preference is to put them in the {cf_installation}/servers/lib directory, making them available to all your ColdFusion server instances (you are using server instance separation for all your different projects, right?). However, in my setup this appears not to work, so I have to put the drivers directly in {cf_installation}/servers/cfusion/cfusion-ear/cfusion-war/WEB-INF/lib for the cfusion server, which kind of sucks in terms of flexibility.

Truth be told, I actually prefer Matt’s idea – put the drivers somewhere you’ll remember them and separate from your ColdFusion install. What this does, of course, is let you mess as little as possible with the standard ColdFusion install. Unfortunately, there doesn’t seem to be an easy way of doing this in the Multiserver install of ColdFusion that I use and recommend in The ACME Guide. Maybe the option to add more directories to the classpath can be an option in Scorpio (Hmmm? Scorpio team?)…

Now, the are several options for placement of these files. The official documentation for this is here, there are several Technotes (the MySQL one here) and Christian Cantrell discusses managing the classpath in a fairly old blog post here.

3 Replies to “Don’t forget the drivers!”

  1. Actually in the context of that guide I was describing how to set up the DBEdit plugin connections in Eclipse, not how to get CF to talk to your databases, so what I outline is correct in that limited context. That being said, it probably would be convenient to put the drivers in a place that both CF and DBEdit could use them, so I’ll revise that a bit to outline that as an option.

    If you put the drivers somewhere other than in CF’s classpath and you’re on a multi-server install, you would have to log into the JRun administrator (not the CF administrator) to add the jar file to the classpath, which isn’t a huge deal but isn’t the most convenient thing in the world either.

    Thanks for the feedback–I’ll get things updated and point people to this post for additional info/background.

  2. Hay, Matt. I wasn’t having a dig at you, it’s just something that I came across as I was setting this up today. It’s actually a big pain. Here I am, wanting to mess with the config as little as possible and:

    • I can’t point dbEdit and ColdFusion datasources at the same instance of the driver, unless I point dbEdit at the drivers inside JRun
    • due to some wierdness, that may be local to me, I can’t add drivers at {cf_installation}/servers/lib and have them recognised by all my server instances (I run a separate server instance for each client development, as I don’t want mappings, custom tags, etc. all mixed in), so I have to bury them deep inside each server instance at {cf_installation}/servers/{server_name}/cfusion-ear/cfusion-war/WEB-INF/lib.

    So, I wasn’t hassling you, but just pointing out something for the unwary, as I managed to trap myself on the same issue.

  3. No worries–feedback is always welcome so I’ll make that more clear. What I was thinking from a maintenance standpoint is if you do point DBEdit to the same place as the JRun drivers, then if you have to update the drivers you only have to do it in one place.

    I have the exact same problem on the Mac as you do concerning adding drivers at CF_ROOT/servers/lib. I also have to put them inside each server instance. Putting in the higher-level lib directory *does* work for me on Windows though, so I’m not sure what’s up with that. I believe I had the same issue on Linux that I have on the Mac, so maybe it’s a weird *nix issue.

Leave a Reply