- Download DB2 for Mac.
- Follow this PDF guide.
- Follow the instructions in this blog post to install the IBM DB2 Ruby Gem.
Attempt to create the database “SAMPLE” failed. SQL1205N The code page “1208″ and/or territory code “0″ that has been specified is not valid.Obviously this had to do with my code page. Adding these two lines to my .profile file solved the problem:
export LC_ALL=en_EN.UTF-8 export LANG=en_EN.UTF-8Don't forget to source your .profile file and you'll be good to go.
Connection error: [IBM][CLI Driver] SQL30082N Security processing failed with reason "42" ("ROOT CAPABILITY REQUIRED"). SQLSTATE=08001 SQLCODE=-30082The solution: Stop the DB2 server with the db2stop command and restart it with
- sudo gem install radiant (it's version 0.6.9 as of this writing)
- Create a new radiant app:
radiant mygreatapp
- Edit config/database.yml
We'll only edit the development section. Make it look like this:
development: adapter: ibm_db username: your_username password: your_password database: db2_dev
- Create the database (note: it's name cannot be longer than 8 chars!)
db2 create database db2_dev
- Freeze Radiant to the vendor dir (we'll have to edit it):
rake radiant:freeze:gems
- OK, when the ibm_db gem can't rename columns. So we'll have to use this really ugly hack: Delete all the 21 migrations in the vendor/radiant/db/migrate directory and place this single migration file in there:
- Now run rake db:bootstrap
- Start the app with ruby script/server
- Go to http://localhost:3000/admin and login with admin/radiant
- You should be able to use your Radiant CMS now, running on DB2!
Comments
Anonymous said...
where is my .profile???
December 22, 2009 06:16 AMJohannes Fahrenkrug said...
Thank you for that, Ian, that was very thoughtful.
January 15, 2009 06:34 AMIan Bjorhovde said...
Johannes,
I added the comment so that (hopefully) other RoR developers (who aren't familiar with DB2) don't start trying to run their DB2 instances as root...
Cheers,
Johannes Fahrenkrug said...
Hi Ian,
Thank you for the tip! In my special setup I'm not concerned about security: It's just my development laptop and I just wanted to get DB2 up and running with Ruby, Rails und Radiant as a proof that it works. This post is by no means meant to be a description of a production setup.
- Johannes
Ian Bjorhovde said...
Hello.
Good post, but you don't want to start db2 using 'sudo db2start'. Running your entire DB2 instance as root is not a great idea for security reasons.
There are a few SUID root binaries in a typical DB2 instance that handle specific tasks like authentication.
To avoid the authentication errors, you have two options:
1) Install DB2 as root (sudo db2setup)
2) Use the 'db2rfe' tool to enable the instance; however, please note that with the current beta db2rfe does not work.
Good luck
Johannes Fahrenkrug said...
Your .profile is directly in your home directory. If not, you can simply create it.
December 23, 2009 11:48 AM