Install DBD::Oracle and Oracle Instant Client on Ubuntu

Update: If you’re looking for instructions for Ubuntu 12.04 and later, most of the steps below still apply, but there are a few small differences nicely explained by Rob Staveley at http://bimport.blogspot.com.au/2012/05/using-perl-dbi-with-oracle.html

Update 2: It turns out these steps can be used for Cygwin as well. Thanks to Marc for pointing it out.

A couple of weeks few years ago I finally got a new laptop at work – which meant of course that I had to reinstall everything. Although we used Windows XP, there was one app that I had to run through Linux. The solution was VirtualBox running Ubuntu. When I tried to run the app, I realized that I still needed to Install DBD::Oracle and Oracle Instant Client on Ubuntu – which brings me to this article. Nothing better than a reinstall to generate article material 🙂

DBD::Oracle is usually a pain to install if you haven’t already done it a gazillion times. After that, it’s just an annoying itch. In this article I’ll cover installing DBD::Oracle using Oracle Instant Client, Ubuntu 9.04 (at the time – I’ve had reports that this works on 12.04 and up), and Perl 5.10. Since we’re using the Instant Client, you’ll need an Oracle DB you can connect to in order to do the testing. You can choose to skip testing altogether, but you might be into an unpleasant surprise later. Continue Reading…

Perl: Installing MQSeries CPAN module on Windows XP

Installing MQSeries module on Windows XP is a piece of cake, as long as you get the right tools before you even try.

Update: October 29, 2018 I haven’t worked on Windows for the past 8 years when we switched to Macs company wide so I haven’t really been keeping up with the MS world. Fortunately, a kind soul reached out to tell me that Visual Studio Express has been discontinued in favor of Visual Studio Community (thanks, Laura!). I’ve updated the download link to get C++ below. Feel free to read more about VSC in this post that Laura wrote.

Update: July 2, 2009 I had to install the module on a new computer running Windows XP and it looks like I had missed a few steps in the original how-to below. It’s been updated with the manual editing steps. From step 3 down, it’s all new.

This is what you need:

  1. MQSeries installed (get the 90-day trial version here. You will need to register, but there’s no charge for that)
  2. Microsoft Visual C++ (it’s free, and you can get it here)
  3. Perl (I use ActiveState)

Steps to get it installed:

  1. Open a command prompt (Start->Run->cmd.exe)
  2. (Extremely important!!)Set up your build environment by running vcvarsall.bat. Mine is under C:Program FilesMicrosoft Visual Studio 9.0VC
    An alternative to this step is to open a Visual Studio 2008 Command Prompt (Start->All Programs->Microsoft C++ 2008 Express Edition->Visual Studio Tools->Visual Studio 2008 Command Prompt)
  3. Make sure your environment variables are set with MQ data: INCLUDE=pathtotoolscinclude directory, LIB=pathtotoolslib directory (typing set will show you your env vars)
  4. Install pre-requisite Params::Validate by running perl -MCPAN -e “install Params::Validate”
  5. Download MQSeries manually by running perl -MCPAN -e “get MQSeries”
  6. cd into the directory where you have your cpan (mine is c:Perlcpanbuild) and enter MQSeries-x.xx-* (where * is a series of random chars if you’re using the latest CPAN)
  7. With a decent text editor (I’m using Notepad++ and also like Crimson Editor and Programmer’s Notepad 2), edit CONFIG file: uncomment MQMTOP = … and replace the path with the path to your MQ Tools directory. It’s OK to use long directory and file names (e.g c:Program FilesIBMWebsphere MQTools)
  8. Now cd into the utils directory, open parse_headers file and comment out or delete the line near the top where it says “my $include = ‘/opt/mqm/inc’;”. The reason for this is that my overwrites the $include variable previously populated by parse_config file.
  9. Save your changes and in the base directory for the MQSeries build, run perl Makefile.PL. It might complain about some libs not being found, but that wasn’t a show stopper for me.
  10. Run nmake. It came with your MS Visual C++ install and should be in your PATH.
  11. Run nmake test. It’ll fail, since you didn’t set any valid data in the CONFIG file. If you have any valid data such as QM and Queues to test it with, go ahead and set them in the CONFIG file and run nmake test again. If not, that’s OK.
  12. If nmake test was the only place where it failed, then you’re good to run nmake install.

That’s it – Perl MQSeries module should now be installed.