2008-04-23

Part 2: Drupal 6.2 and DB2 Express-C 9.5 on Ubuntu 7.10

This is part 2 in my series on getting Drupal 6.2 and DB2 Express-C 9.5 to play nicely with each other. In the first part, I installed DB2 Express-C 9.5. In this part, I'll look at getting Apache/PHP5 setup and DB2 working from within PHP.

Step 1: Configuring DB2. There were some additional configuration steps needed for DB2, which are detailed on the developerWorks forum. There were some superfluous steps, but the worst you're going to do is overwrite something with the same thing. In particular, all the user accounts were set up already. If you're not familiar with DB2, you can issue commands from the shell, in the form of:

db2 "create database testdb"
but just make sure you're running these commands as the user db2inst1, or you source db2inst1's db2profile. If you can create `testdb`, then DB2 is working correctly.

Step 2: Install Apache httpd 2.2 and PHP 5.2. The Ubuntu Guide has information on setting up Apache and PHP, but the quick and dirty steps are:
sudo apt-get install apache2
sudo apt-get install php5 libapache2-mod-php5
sudo /etc/init.d/apache2 restart
Step 3: Install DB2 support for PHP. There is a PECL module for IBM DB2, which can be installed with PHP's PEAR (PHP Extension and Application Repository, like apt-get for Ubuntu).
sudo apt-get install php-pear
sudo pecl install ibm_db2
When I first ran this, I got the error: "sh: phpize: not found". After doing a quick search, I realized that I needed the PHP development files to be able to compile the DB2 driver:
sudo apt-get install php5-dev
After the module is compiled, it will ask you where your installation of DB2 is. In my experience, it wouldn't believe me when I told it where DB2 was installed to. Luckily, it ended up not mattering. When you get to this part of the PECL install, just hit Ctrl-C.

Next, I needed to configured PHP to use the IBM DB2 driver. In `/etc/php5/apache2/php.ini`, go to the extension section and add:
extension_dir="/opt/ibm/db2/V9.5/dsdriver/php32"
extension="extension=ibm_db2_5.2.1.so"
Note: correct the path if you have your module installed somewhere else; do a `locate ibm_db2_5.2.1.so`)

After making the changes, I reloaded Apache:
sudo /etc/init.d/apache2 reload
Verify that the module is loaded by making a quick PHP page in /var/www/ with the content:
<?php phpinfo(); ?>
and make sure there's a DB2 driver loaded. I started playing around with DB2 in PHP, but it was getting late and I decided to put that off for another day. IBM has some information on developing PHP5 for DB2, but it's barebones at best. I'll post a sample script next time.

Ok, so at this point, I have Apache, PHP, and DB2 Express-C 9.5 all installed and playing well with each other. In the next article in this series, I'll look at getting Drupal 6.2 to use DB2 on the back end.

2008-04-22

Part 1: Drupal 6.2 and DB2 Express-C 9.5 on Ubuntu 7.10

DrupalFinally! It's been far too long since I've had an interesting project to work on. With a couple of sites I might have to make in the foreseeable future, it's time to investigate what I can do with stuff available today. There's a couple of reasons I've hit upon Drupal 6.2 and DB2 Express-C 9.5:


  • Silicon Valley Lab had it's inaugural meeting of the SVL Linux Users Group this morning. I recognize that this is extremely nerdy, and even nerdier to be so excited about it. But the turnout for the SVLLUG's first, unstructured, sort of planning event was about 50 people. Now, to put this in perspective, at any one point in time, I've had about five friends interested in Linux. 50? All of which who are guaranteed to be on campus eight hours a day, five days a week? I'm certainly going to take advantage of it!

  • Seriously, I work for DB2. If I can't get this database to work with Drupal, I will pester people until I have it working, and then I'll blog about it.

  • With MySQL drifting away from open source (come back MySQL! Come back!), I don't see a whole lot of reason to use it. MySQL doesn't exactly have the most cutting edge features (native XML support), and if it's free in the same sense as DB2, why not? IBM has always supported Drupal (15 part series!)

  • I recently read an article comparing Django and Drupal. I've used Drupal for a couple of web sites in the past, and been happy overall. The problem always ended up being with 3rd party modules, but I'd rather have an architecturally sound framework than something flashy that won't last.
Anyway, first thing's first:
  1. Download DB2 Express-C V9.5 for Ubuntu: it's as easy as `sudo apt-get install db2exc`, but you can find more information on Ubuntu's DB2 Virtual Appliance Page

  2. Download Drupal 6.2

  3. Install Apache httpd with PHP support

  4. Install DB2 driver for PHP
Ok, in the time it took to write that post, DB2 Express-C has downloaded and installed. Time to start playing; next post will be how to do steps 3 and 4.

2008-04-01

The Coshocton Cycle

Note: I wrote this in high school for the heck of it, and eventually transformed it into my college admission essay. It's amazing they let me in ;-)

The Coshocton Cycle


I live in Small Town, USA. This particular small town is called Coshocton, Ohio. The Indians named the area "Land of the Black Bear," but the bears are long gone. Our biggest store is a Walmart, and there is not much in the line of entertainment. There's a bowling alley and a sporadically open movie theater. The population is about 12,500 in the city and 39,000 in the entire county. Apart from Coshocton City, West Lafayette and Warsaw are the other two wide places in the road.

I've often commented on the stupidity of the people in my town. It seems to me to be full of idiots. I started wondering why people would stay in a town such as this one. All are given the same education in the local school system. Why do some escape the town and others not? About the same time I began wondering, I started going to high school and meeting people from different parts of town. The screw-ups in town often had parents who were screw-ups. However, I can remember at least one person who didn't have the best family background, had the intelligence, and at one point had the drive to get of this town. She was going to break this cycle of unambitious citizens populating the county with more of the same. However, she made a few decisions in order to fit in. She decided to smoke. She decided to have a boyfriend, who had been in jail, and to have sex with him. Then, she talked of marriage, and it became clear: the small town, small-minded cycle of apathy broke her.

One major mistake causes people to be stuck in this town. A relationship with a screw-up will do it. Getting pregnant in high school will trap you here forever. Dropping out of high school. "Postponing" college for a while. Drugs. It all feeds the cycle, and the cycle feeds itself.

What is the one consistent reason for all of these mindless decisions? Apathy. At one point or another, people just stop caring. Apathetics being the majority in Coshocton, it's easy for them to rationalize with the thought, "No one else cares." No one else is successful, either. There seems to be something about this town that harbors apathy; something that makes you think "everything is okay the way it is," when that is so far from the truth that it's laughable. It's like trying to boil a frog: if you drop him into boiling water, he'll jump out. But if you put him in temperate water and then slowly raise them temperature to boiling, the frog will die.

For me, Coshocton High School was the second scenario. Seventh grade, wow, you can accomplish anything if you put your mind to it. Right now, I'm in my senior year, and I have a few points to add to that previous statement: "... only if no one else of higher status wants to do it instead," "... only if your idea is so conservative there's nothing that really characterizes it as yours," "...only if influential persons don't feel threatened by you," "... only if you have the correct last name," and "...only if you care enough to overcome these previous hindrances." That last point is the most important. You have to care. You have to step back, look at everything and say, "I'm going to break the cycle." You can't lose touch with this goal. One critical slip, and you've re-fed the cycle.

I have a friend who wrote an article for the school newspaper entitled "Masses of Apathy," describing student life at Coshocton. The administration jumped on it, and criticized it as being completely unfounded. The administration forgot the goal a long time ago. Not only are they feeding the cycle, they are making it grow with each additional year. Do they mean to? Probably not. But the water they've been living in has been warmed so slowly, that they can't see anything wrong with it.

A few students jump out of the water. They go to successful colleges and get fantastic jobs. They deserve a hero's welcome when they return to Coshocton. Except... Most of them don't come back. Those who do return because they want to, not because it is their only option. However, the number of these individuals is dwarfed by those who do not come back. Who in their right mind would step back into water that is so obviously scorching? It's almost like natural selection: the motivated people leave town, not staying to have motivated offspring in this town, and fewer and fewer motivated individuals are produced by the town. Have you ever seen native Coshoctonian Bob Brenly giving public speeches in Coshocton?

Just recently, instead of looking at people as they are now, I've tried a new spin. I try to think of them twenty years into the future. It's scary and depressing just how many people can easily be seen falling into the cycle, ready to begin it again with their children. Try and think of your best friend working at the video store, full time, for fifteen years. Depressing thought? Now try the same thing for all of your peers. It's amazing how many of mine that I can picture doing just that.

Don't lose your vision. If something seems wrong to you, but no one else, don't concede so readily. You may very well be correct, it's just that no one else is willing to admit that. The worst thing you can do, in Coshocton, is go with the norm. The norm is so skewed, and yet no one seems to notice. They can't see the forest for the trees; all they see is the general attitude of the town. They become mindless blobs... and it all began with apathy.

Don't stop caring. Not only can you screw your life up, but quite possibly your friends' and family's, making the cycle only grow out of proportion. I'm not saying be perfect; that's impossible. Make mistakes, and learn from them.The only irrevocable mistake is when you stop caring.