Monday, August 22, 2005

IBM DB2 on Fedora Core 3 64-Bit

I have moved on to my next adventure in writing a native database interface. We have decided to add native DB2 support to our product offering. I was fairly excited when I first started out to install this but after 5 days, I am frustrated and dismayed at the lack of forethought or testing put into the product. I downloaded DB2 8.2 from IBM's web site and installed the 90-day trial for enterprise edition on my Sun Sunfire V20Z development server running Redhat Fedora Core 3, 64-bit edition. Now I bet there are alot of people who want to test DB2 under these types of conditions and from what I read, it just won't work.

I downloaded the installer and followed the Redbook readme on installing using VNC as the XHost, from my Windows XP workstation, this was a breeze. I switched from twm to Gnome almost immediately but other than that, nothing special was done. I expanded the tar and then ran the db2setup script which promptly launched me into a nice looking Java-based installer, so far, so good. I was impressed. I ran through the entire install with no problems at all. Afterwards, the Redbook suggested I get a VNC session up under the db2inst1 user. No problem there. I connected to the db2inst1 user via VNC and was ready to run the db2fs (First Steps) command.

I was very pleased to see a folder on my XWindows desktop called IBM DB2 containing several icons to manage my DB2 system. This was impressive. A double-click later and


There was an error launching the application.
Details: Failed to execute child process "db2fs" (No such file or directory)
OK


Interesting, I don't know why they would do all the work to get you the icons if they didn't link to anything (none of them worked except release notes). I set out to locate the db2fs program and found it in /opt/IBM/db2/V8.1/bin/db2fs. Ok, no biggy, I can write a full path out.

[db2inst1@sunfire1 ~]$ /opt/IBM/db2/V8.1/bin/db2fs
/opt/IBM/db2/V8.1/bin/db2fs: line 14: db2javit: command not found
[db2inst1@sunfire1 ~]$

What the heck? 2-days later, I found out this has to do with the JAVA_HOME environment and some other env variable items. I am not sure what got me to the next error but I installed the actual 64-bit JAVA for FC3 (IBMJava2-AMD64-142-SDK-1.4.2-2.0) and ran a few commands I found in various newsgroups.
export JAVA_HOME=/opt/IBMJava2-amd64-142
db2 update dbm cfg using JDK_PATH /opt/IBMJava2-amd64-142/
db2 update admin cfg using JDK_PATH /opt/IBMJava2-amd64-142/
export PATH=$PATH:$JAVA_HOME/bin
export LD_LIBRARY_PATH=/home/db2inst1/sqllib/lib:/opt/IBM/db2/V8.1/lib:/opt/IBM/db2/V8.1/das/lib:/opt/IBM/db2/V8.1/lib64

Now I noticed that even though I had added the suggested env variables before install of
export DB2USELOCALJRE=TRUE
export JAVA_HOME=/opt/IBMJava2-amd64-142/

that it still installed it's own verion of IBMJava, IBMJava2-SDK-1.4.1-2.0.

With all of these changed, I am now up to:

[db2inst1@sunfire1 ~]$ db2cc
Exception in thread "main" java.lang.UnsatisfiedLinkError: db2jcmn (/opt/IBM/db2 /V8.1/lib/libdb2jcmn.so: cannot open shared object file: No such file or directo ry)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:934)
at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:903 )
at java.lang.System.loadLibrary(System.java:378)
at com.ibm.db2.common.objmodels.dbobjs.DB2Level.<clinit></clinit>(Unknown Source)
at java.lang.Class.initializeImpl(Native Method)
at java.lang.Class.initialize(Class.java:339)
at CC.<init></init>(Unknown Source)
at CC.main(Unknown Source)
DB2JAVIT : RC = 1

libdb2jcmn.so is in the directory. But still no dice.

I moved on and decided I didn't really need to be able to run any of the administration toold on FC3 and installed the admin tools on my WinXP workstation. I was pleasantly suprised that I was able to connect to the database (something I found out you can't do in the developers personal edition) and even see my instance. Now came the time to actually create a database. I fired up the create database wizard in Control Center and created a no frills database TEST in the /home/db2inst1 directory. Up comes Creating Database dialog box and the gears spin with the elaped time counter running. The gears just keep spinning. After several hours, I get a SQL22207 which has no useful information and no database is created.
SQL22207

The DB2 Administration server cannot execute the script at host
"sunfire1". Reason code "4".

Explanation:

The DB2 Administration Server failed to execute the script for
one of the following reasons:

1. The user specified an existing script and the script does not
exist.

2. The script working directory is invalid.

3. The last line of the script failed to run because a statement
termination character could not be found.

4. A system error occurred while attempting to execute the
script.

User Response:

Depending on the reason for the failure, attempt one of the
following:

1. Verify that the script specified exists on host
"<hostname></hostname>" at the path provided.

2. Verify that the working directory is valid on host
"<hostname></hostname>".

3. Verify the script contents and resubmit the request.

4. Refer to the DB2 Administration Server's First Failure Data
Capture Log for additional information.

If you continue to receive this error message after attempting
the suggested response, refer to the DB2 Administration Server's
First Failure Data Capture Log for additional information or
contact IBM Support.

I did some research and found that SQL22207 is some sort of rights problem. At this point, I can't really get any further. I decided to try the install in a virtual server on my Windows 2003 Server and it works perfectly out of the box. I can create databases and now it's time to move on to writing some code against it.

No comments:

Post a Comment