From: Nicholas Quaine Date: 2008-04-28T19:50:36+09:00 Subject: Re: DBI:ibm_db connection for IBM DB2 database Hello Antonio, firstly - a big thank you for your help - my connection to DB2 from Ruby now works perfectly. As often happens with searching for solutions via the internet, the available published help included both deprecated information and information pertaining to similar but not identical circumstances - your post put everything straight. > please note that there are newer, improved versions for all three gems > mentioned above. The new ones are recommended, but utilizing the > versions that you chose shouldn't affect your results in most cases. I had chosen these because in my DB2 server v9.5 installation, ibm_db v0.8.5 was bundled so I assumed it to be the most compatible - and the versions of the other gems were the minimum required. >> I have also (as required by the IBM documentation at >> http://rubyforge.org/docman/view.php/2361/967/IBM_DB-0.6.0.pdf) added >> ‘ibm_db’ to the list of connection adapters on line77 of >> gems\1.8\gems\activerecord-1.15.3\lib\active_record.rb : >> >> RAILS_CONNECTION_ADAPTERS = %w( mysql postgresql sqlite firebird >> sqlserver db2 oracle sybase openbase frontbase ibm_db ) > > This step was formerly required in order to inform ActiveRecord about > the existence of an ibm_db adapter. With newer versions of ActiveRecord > this is no longer a requirement. In either case, this was necessary only > for using ActiveRecord with the ibm_db adapter and not a requirement for > the ibm_db driver, contained in the gem too, to work. This is good to know. Although I am still not clear on what the difference is between a database adapter for ruby and a database driver for ruby. > Ruby-DBI doesn't have an ibm_db interface. It has its own DB2 driver, > that is not created nor supported by IBM, and it hasn't received an > update in more than 2 years. I wouldn't recommend going for the DBI > route. More good info - confusion for newbies such as myself on this point stems from a number of things : the variable intentions behind terminology such as database interface, adapter and driver; the use of terms like "driver for DB2 on linux" - does this mean linux is client or server side?; developers talk of the DB2 DBI solution and use ibm_db v0.44 which must be the one from two years ago, and then we see ibm_db version 0.8.5 or 0.9 and think that it is a later version of the same beast (and therefore implementable in the same way) but reading your post, it seems that they are quite different. Note this is not a gripe - I mention all this only to list the gotchas for anyone who is interested. Further confusion arose in my case because there is a profusion of info out there for DB2 connection from Ruby on Rails - which tends to drown out the info that is available for just Ruby to DB2 without the Rails - in the end you start to wonder whether or not it is possible without Rails - but as you have shown me, it is indeed possible. > The IBM_DB Ruby driver is "high level enough" to let you interact with > DB2 with ease. I prepared a guide to get people started, and you can > find it here: http://rubyurl.com/a0tS. This is a great guide. I would add that another "driver" (we are running out of terms here) is required : the IBM Data Server Driver for ODBC, CLI and .Net must be installed on the client machine and afaik interfaces ibm_db ruby module with the database server via ODBC/CLI. thanks again for your help. Nicholas Quaine -- Posted via http://www.ruby-forum.com/.