Support for Ruby 1.9.1 and Rails 2.3 is here

The IBM API team just released a juicy update of the ibm_db gem. Version 1.0.5 packs support for ActiveRecord 2.3.2, which is included in the latest, recently released version of Rails, as well as being compatible with Ruby 1.9.1 (you can read this post of mine to learn why this is important). To be more exact, this release enables the driver to work as a ASCII driver when using Ruby 1.9.1, with Unicode support to follow in upcoming releases.

1.0.5 also includes support for the SQLRowcount feature and fixes three bugs: one related to setting the schema on z\OS, another about LOB handling, and finally an edge case about nested queries that were truncated.

To install or update this gem on Windows, simply run:

gem install ibm_db

On Linux, run the following:

sudo -s
export IBM_DB_INCLUDE=/home/db2inst1/
sqllib/include
export IBM_DB_LIB=/home/db2inst1/sqllib/lib
gem install ibm_db



[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Posted by Antonio Cangiano | March 26 2009 | Announcements | 1 Comment »

IBM_DB 1.0.2 released

A few days ago the IBM API team released an update for the Ruby driver and Rails adapter for IBM databases. This specific release of the IBM_DB gem (1.0.2) fixes a couple of LOB related bugs that were recently found, and adds support for the timeout parameter for ActiveRecord. In practice this means that you’ll now be able to specify a timeout value within your config/database.yml file, which expresses the amount of time in milliseconds seconds before an attempt to establish a connection with DB2 timeouts.

For example, the development section of said configuration file may look like this:


development:
 adapter: ibm_db
 username: db2inst1
 password: secret
 database: db_name
 schema: myapp
 timeout: 5

In this case, the timeout for each connection was 5 seconds.

We hope you’ll find this release useful. Give it a try, and please report any issues, however unlikely they may be, in the RubyForge forum.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Posted by Antonio Cangiano | March 12 2009 | Announcements | 1 Comment »

DB2 on the new Rails Wiki

The Rails team launched a new wiki, as the previous one had become way too messy. You can read about the reasons behind this choice in the official blog announcement. There wasn’t a DB2 page among the supported databases pages so I created one here. It covers the installation of the ibm_db gem, how to create a Rails app with a config/database.yml file prepopulated for DB2, and also provides a few helpful pointers. If you find any issues with it, please let us know or feel free to modify it yourself.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Posted by Antonio Cangiano | February 12 2009 | How-to | No Comments »

Using DB2 and Rails on Mac OS X

It was pre-announced over the weekend and has now been officially announced: DB2 Express-C for Mac OS X is finally available for download. To help get you started from the Rails side of things, this announcement also contains a few hints regarding how to set up your ibm_db stack and how to use it on our newest platform. Enjoy! :)

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Posted by Antonio Cangiano | December 23 2008 | Announcements and How-to | No Comments »

Common pitfalls when installing the ibm_db gem

Installing the ibm_db gem on Windows is as easy as running gem install ibm_db. Next to no problems have been reported, as the the installation is as smooth as it gets. On Linux things can get a bit trickier though. Having helped dozens of people resolve installation problems, I’ve gathered some insight into what the common pitfalls are when installing the ibm_db gem on *nix systems. Here I’ve put together a checklist, in case you’re experiencing issues with your own install.

First and foremost, the most common error message is a variant of the following:


$ sudo gem install ibm_db
Building native extensions.  This could take a while...
ERROR:  Error installing ibm_db:
	ERROR: Failed to build gem native extension.

/usr/bin/ruby1.8 extconf.rb install ibm_db
checking for SQLConnect() in -ldb2... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
  ...
  ...

The gem fails to install because the SQLConnect() function provided by DB2’s development headers (which are required to build the gem) cannot be found/loaded.

This brings us to our quick checklist:

1. Have you sourced the profile? This is done by running:

. /home/db2inst1/sqllib/db2profile

You may need to replace the dot, with source depending on your shell.

2. Have you specified where DB2’s directory and library are to be found? You can do so by running:


export IBM_DB_DIR=/home/db2inst1/sqllib
export IBM_DB_LIB=/home/db2inst1/sqllib/lib32

3. Did you install the required development headers during the installation? These are available by selecting “Base application development tools” under the section “Application Development Tools” in the DB2 Setup Wizard (having selected a “custom” installation beforehand).

You can double check this by running:

ls /home/db2inst1/sqllib/include

This should show you a series of .h files, including sqlcli1.h. If you don’t see them, then you need to repeat the setup procedure so as to add the development tools. Likewise, you should also see a series of .so files, including
libdb2.so when you run: ls /home/db2inst1/sqllib/lib32.

4. Are you trying to perform the installation when logged in as the db2inst1 user? If you’re doing this, it’s best not to. It doesn’t matter if db2inst1 is a suoder or not. Don’t run sudo gem install ibm_db as the instance user.

5. If nothing else works, try to install as the root user (on certain systems sudo won’t cut it). The following complete procedure works in 99% of cases:


sudo -s
. /home/db2inst1/sqllib/db2profile
export IBM_DB_DIR=/home/db2inst1/sqllib
export IBM_DB_LIB=/home/db2inst1/sqllib/lib32
gem install ibm_db

If this checklist doesn’t help you, then you can reach for the RubyForge forum, where the DB2 on Rails community and the IBM team will be happy to help you.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Posted by Antonio Cangiano | November 11 2008 | How-to and Tips&Tricks | 1 Comment »

A major milestone for DB2 on Rails

The IBM API development team has released version 1.0 of the ibm_db gem, which includes both the Ruby driver, and the Rails adapter, for IBM’s databases. This is a very important milestone for the DB2 on Rails community, and it ships with quite a few goodies.

Besides a few bug fixes, this version adds support for DB2’s secure connections via SSL, short-hands to use char, double and xml when using both create_table and change_table in Rails’ new “sexy migrations”, and enables change_column_null to work with DB2.

Even more importantly, it adds support for Transactional Migrations in Rails 2.2. What this means to you is that any DDL changes performed by a migration file before an exception has been raised, will be rolled back by DB2. This is a handy new feature in Rails 2.2, and our gem backed support for it, even before this version of Rails was shipped.

Speaking of Rails 2.2, which is about to be released, you’ll finally be able to run rails my_app -d ibm_db. This will generate a DB2-specific config/database.yml file. This move is possible thanks to a patch that was submitted by IBM to the Rails team. As handy as it is, the great news is not so much in this new feature, but rather in the fact that the Rails team has shown that they’re open to accepting patches that extend features to commercial databases as well, and not only the three open source ones they support. This can open up a world of possibilities for the future of DB2 on Rails, and it will mean less reliance on external plugins.

As usual, install as follows (on *nix systems):


$ . /home/db2inst1/sqllib/db2profile
$ export IBM_DB_DIR=/home/db2inst1/sqllib
$ export IBM_DB_LIB=/home/db2inst1/sqllib/lib
$ sudo gem update
$ sudo gem install ibm_db

On Windows, simply run:


gem install ibm_db
[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Posted by Antonio Cangiano | November 08 2008 | Announcements | 21 Comments »

7 ways to contribute to the DB2 and Informix communities

The community surrounding DB2 is steadily growing, both within IBM and outside. Today is the first Online Community Action Day during which IBM invites IBMers, and information management product users in general, to actively participate more in the community.

Whether you use DB2 with Ruby, Rails or on its own, you too can get involved. And the same goes if you opt for Informix instead. Here are a few suggestions:

  1. Head on over to ChannelDB2 and register;
  2. Sign up for free with the IDUG or IIUG user groups;
  3. Join a Facebook group for DB2 or Informix;
  4. Take a moment to respond to even a single question in the developerWorks forums or on comp.databases.ibm-db2 (or comp.databases.informix
  5. Send an e-mail to a couple of colleagues or friends and pass on links to ChannelDB2, PlanetDB2, Informix Zone, the XML Contest homepage (which went live today), or other community sites;
  6. Find a blog post that you appreciated and take the time to leave a comment saying “thank you”.
  7. If you are feeling ambitious, start your own blog about DB2 or Informix, sharing your experiences with the community.

There you have it. And whatever you decide to do, remember that it greatly benefits our community and can help foster its growth. Thank you.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Posted by Antonio Cangiano | October 01 2008 | Announcements | No Comments »

New support for Rails 2.1

Support for Rails 2.1 has been added to the latest version of the ibm_db gem (0.9.5). To install this version run gem install ibm_db on Windows. On Linux run the following:

$ . /home/db2inst1/db2profile
$ export IBM_DB_DIR=/opt/ibm/db2/V9.5
$ export IBM_DB_LIB=/opt/ibm/db2/V9.5/lib32
$ sudo gem install ibm_db

Adjust these commands for your paths, shell and architecture (e.g. 32 vs. 64 bits).

Please note that at this stage we don’t recommend that you download the outdated Starter Toolkit for DB2 on Rails. Instead, please grab and install DB2 Express-C, install Ruby through the One-Click Installer, install Rails through gems (gem install rails) and then proceed to install the ibm_db gem as explained above. When you install DB2, ensure to select the “Base application development tools” as illustrated here.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Posted by Antonio Cangiano | June 26 2008 | Announcements and How-to | 4 Comments »

DB2 and Rails 2.1

Rails 2.1 was released last week at RailsConf 2008, in Portland. Despite being a “minor version” increase from 2.0.2, it introduces quite a few changes. Some of these affect the DB2 adapter, so it is recommended that you don’t upgrade to Rails 2.1 yet.

The API team is fully aware of the outstanding issues and is working on bringing DB2 compatibility to Rails 2.1. An announcement in this blog will be made when a new release is available.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Posted by Antonio Cangiano | June 06 2008 | Announcements | 3 Comments »

Ruby for building Yahoo! BrowserPlus services?

There has been much discussion (if you can call it that) in the Ruby on Rails community regarding a need for using applications while disconnected. I happen to be believe that despite the proliferation of connectivity options, ability to use web applications off-line is absolutely crucial. So, I’ve been looking at various technologies for taking web applications off-line. I am a big fan of Adobe Flex partly because it can be used to produce web-based applications that run on Adobe Air. I’ve also been watching Google Gears (now unbranded from Google). Just a few days back Yahoo went for a “Sneak Peek” availability of their BrowserPlus. So, I decided to install Yahoo BrowserPlus and give it a try with a few Yahoo properties that use it today.

I tried the FlickrUploader demo and go this dialog. This is actually expected and it is a good thing. Basically, what this means is that FlickrUploader needs these services and BrowserPlus is offering me to activate them:

Ruby is now in Yahoo! BrowserPlus

This dialog suggests that FlickrUploader needs Ruby.  I presume that this is because FlickrUploader is written at least in part using Ruby? After a bit more reading I am getting a feeling that we will be able to use Ruby to add extra functions and services to BrowserPlus. At least that is implied by all of the info I was able to find on the subject. Unfortunately, BrowserPlus is still in the “Sneak Peak” release mode (Yahoo must of run out of Greek letters) so it is not possible to try to add BrowserPlus capability to anything but a Yahoo operated site in Ruby or otherwise. I do however like the direction in which BrowserPlus seems to be heading and I love the fact that they chose to support Ruby.

Oh yeah, almost forgot to mention … at this point in time it is more of a promise than reality. I tried to activate the RubyInterpreter service and got “Not compatible”:

RubyInterpreter not compatible message in Yahoo BrowserPlus

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Posted by Leon Katsnelson | June 03 2008 | Musings | No Comments »

Next »