Posted on 13 January 2009 by Johannes Fahrenkrug. Tags: db2programmingtutorialsrubyrailsLast year ended with an amazing announcement: IBM DB2 for the Mac! I have worked with DB2 for years and it's a truly great database. Who would have thought that Big Brother would bring one of it's flagship products to the Mac? And not (directly) to make money, but only for us developers?
![Db2 For Mac Download Db2 For Mac Download](/uploads/1/2/6/3/126388037/254429591.png)
Ok, so how do you set this thing up? Well, I won't walk you through it step by step, but I'll give you the big steps you'll have to take:
- Download DB2 for Mac.
- Follow this PDF guide.
- Follow the instructions in this blog post to install the IBM DB2 Ruby Gem.
- The application belongs to Education Tools. The most popular version of DataStudio for Mac is 1.9. The most frequent installer filename for the program is: DS198r9MacUB.dmg. The unique ID for this application's bundle is com.pasco.datastudio. The actual developer of this Mac application is PASCO.
- To download a trial version of various DB2® database products, go to. For Linux® on AMD64 and Intel® EM64T systems (x64), for Linux® on System z®, for Mac.
DB2 on Mac natively. Here are the current instructions for installing DB2 10.1 on Mac OS X, courtesy of my colleague Kevin Rose: Instructions to install DB2 v10.1 on Mac OS X Yosemite: Prerequisite: XCode developer tools must be installed. These can be installed from the Mac App Store. The db2 jdbc type 2 driver uses the db2 cli interface to communicate with db2 data servers. If you need a more detailed configuration of the database, it's possible to do that by editing the metadata sql-script files. Older odbc-driver for ibm db2 7.1 which i use to just link the tables into. But in classpath for the 9.
Those are the big steps. But I ran into a few minor problems on my machine. So in case you run into them as well, here's how to solve them.
Problem #1 - Error SQL1205N when running db2sampl
When I tried to create the SAMPLE database with the db2sampl command, I got this error:
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-8export LANG=en_EN.UTF-8Don't forget to source your .profile file and you'll be good to go.
Problem #2 - SQL30082N - ROOT CAPABILITY REQUIRED
I got this error when I tried to run the sample Ruby app from the blog post that tries to connect to the SAMPLE database via the ibm_db Ruby Gem. This is what it spat out:
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
Since DB2 uses OS authentication and the DB2 server is started without superuser privileges right after the installation, it can't authenticate other users. So you'll have to run it as a superuser.
So now we can get to what I actually wanted to try: Running the Radiant CMS on a DB2 database. These are the steps:
- sudo gem install radiant (it's version 0.6.9 as of this writing)
- Create a new radiant app:
- Edit config/database.ymlWe'll only edit the development section. Make it look like this:
- Create the database (note: it's name cannot be longer than 8 chars!)
- Freeze Radiant to the vendor dir (we'll have to edit it):
- 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!
This is still pretty raw and I'll post this to the Radiant mailing list, so we can get better DB2 support built right in.
Comments
Johannes Fahrenkrug said...
Your .profile is directly in your home directory. If not, you can simply create it.
December 23, 2009 11:48 AMAnonymous said...
where is my .profile???
December 22, 2009 06:16 AMJohannes Fahrenkrug said...
![Db2 For Mac Download Db2 For Mac Download](/uploads/1/2/6/3/126388037/254429591.png)
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,
January 15, 2009 01:35 AMI 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
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
Ibm Db2 For Mac Download
January 14, 2009 06:36 AMIan 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
January 13, 2009 09:41 PMGood 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
Comments
Please keep it clean, everybody. Comments with profanity will be deleted.
Please enable JavaScript to view the comments powered by Disqus.blog comments powered by