I have installed:
IBM DB2 Express C (1.01)
How should I change the database.yml file in order to my rails application to connect to DB2 database?
I have followed this article:
but there is no example with DB2 database. Also, why it is said that I should change Jruby to use always JDBC adapter.
If you’re using Rails 3, you’ll need to modify your Gemfile to use the activerecord-jdbc-adapter gem under JRuby. Change your Gemfile to look like the following (using sqlite3 as an example):
gem 'sqlite3-ruby', :require => 'sqlite3'
and where should I put the statement above?
NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
This topic has been locked.
2 replies Latest Post - 2012-09-03T15:35:54Z by gotqn
Pinned topic JRuby database.yml file configuration to use IBM DB2
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2012-09-03T15:35:54Z at 2012-09-03T15:35:54Z by gotqn
SystemAdmin 110000D4XK5837 PostsACCEPTED ANSWER
Re: JRuby database.yml file configuration to use IBM DB22012-09-03T13:20:03Z in response to gotqnHello,
The search feature of developerWorks is your best friend :-)
It gives you a sample yml file.
gotqn 270005K47Y6 PostsACCEPTED ANSWER
Re: JRuby database.yml file configuration to use IBM DB22012-09-03T15:35:54Z in response to SystemAdminHi,
I have already checked this article. The example there refers to ruby an rails on ruby, not Jruby.
The IBM has special driver for ruby, but if you need to use Jruby you should use the following driver:
Unfortunately, in this gem documentation there is no example of the settings that you should apply when you are using IBM DB2.
Anyway, I have been able to find finally some information in the context of other examples that let me to this:
where "driver" field remains the same, and the url is your database url.
I am "extremely" new in DB2, but find that the easy way to get this url is from "Data Studio 3.1.1 Administration Client" database properties.
Unfortunately, I am in process of learning both db2 and jruby, so I was not able to test this successfully and am still not able to prove this is the solution of the issue.
Anyway, I will update this settings if I find something wrong in the future.