Looking for help with DB2 support in MediaWiki Comment
MediaWiki is the PHP application underlying Wikipedia and other sites. Over the past couple years, I’ve spent some of my spare time to add DB2 support to it. Here’s where things stand now:
- Working: Installing on DB2 using the old installer
- Broken: Creating and editing articles
- Not implemented: Search
- Not implemented: Installing on DB2 using the new 1.17 installer
Implementing the installer was half the battle, as it required a fully functional DB2 database abstraction layer. I think the main issue with article editing right now are some data inconsistencies in the initial database.
However, MediaWiki is getting a new installer in 1.17. I’ll try to spend some time soon to establish the scope of adding DB2 support to it, and then start implementing.
My MediaWiki time is pretty limited, though. If you or someone you know can pitch in on debugging, maintaining, and expanding the DB2 support in it, I’d be very happy to bring you up to speed and review your initial patches.
Keep in mind that MediaWiki is GPL software.
Some links:
- http://www.mediawiki.org/wiki/MediaWiki
- http://www.mediawiki.org/wiki/How_to_become_a_MediaWiki_hacker
- http://www.mediawiki.org/wiki/Commit_access
- http://www.mediawiki.org/wiki/Manual:Coding_conventions
- http://www.mediawiki.org/wiki/Manual:IBM_DB2
CCleaner utility for Windows
CCleaner is one of my favourite utilities for Windows. It does several things very well.
One of them is removing the temporary files that various applications leave lying around. For example, the Windows temporary files directory gets filled up with various installers that have a tendency to never be removed as well as fragments of files left open during crashes. For another, Windows retains the option to let you uninstall every patch Microsoft issues. This may be useful in a mission-critical server situation, but on a regular machine it just wastes space.
I just had to clean up a very space-constrained virtual machine for work. CCleaner instantly freed up 1.4GB of space simply by removing crud left around by installers and other applications.
CCleaner also does a beautiful job of correcting Registry inconsistencies, finding dead Start Menu shortcuts, and various miscellaneous tasks like free space management and cleaning up the Add/Remove programs list.
Blog dehacked
I apologize if you saw any strange malware warnings last Friday. Someone exploited a hole in my rather old installation of WordPress and added a nasty Javascript scriptlet to every post. They also published every one of my drafts and also truncated every post title to a single word.
Google Webmaster Tools alerted me to the situation with an email. They have since confirmed that all the malware has been removed.
This involved upgrading WordPress to 3.0 as well as going through every post to remove the payload and fix the title. I took the opportunity to purge many of the posts.
WordPress 3.x seems much nicer than my creaky old install of WordPress 2.x. The widgets are very handy, as is the integrated update functionality for both WordPress and WordPress plugins.
Simplify the DB2 9.7 security model
Starting in DB2 9.7, the DB2 security model was changed. Security administration (SECADM) was split off from database administration (DBADM), and users with SECADM permissions could no longer peek at data, at least not by default.
Secure by default is a great practice. It’s fantastic when deploying a production database at a financial institution. However, it’s not so good when you are a new user trying to learn a tool.
Control Center seems to run as SYSTEM by default on WinXP, which leads to errors like this:
OR privilege TO perform operation "SELECT" ON object "LEONSP.ACT".
SQLSTATE=42501
Let’s remedy this by granting lots of privileges all around.
Open up the DB2 Command Window.
Connect to the database as a user that already has permissions (leonsp for me):
Grant all privileges to SYSTEM:
Did you create DB2ADMIN or some other id when installing DB2 on Windows? Let’s grant all privileges to that user as well:
You should now no longer see the SELECT privilege error. Note that you should not do this in a production environment, as this is less secure than the default configuration.
Cataloging databases after reinstalling DB2
On Windows, uninstalling DB2 will remove the instance but keep the databases in place. After you reinstall, you’ll want to recatalog these databases. This is fairly straightforward.
Find out their names:
Map each of the databases that you want:
You can also catalog remote databases the same way. In my experience, this is much easier than going through Control Center:
db2 catalog db SAMPLE as MYSAMPLE at node MYNODE
db2 connect to MYSAMPLE user MYUSER using MYPASSWORD
The database will now show up in your Control Center catalog. You will also be able to connect to the local alias from Data Studio and other tools.
Going from DB2 Enterprise to DB2 Express-C
Downgrading from DB2 Enterprise to DB2 Express-C is a fairly straightforward process.
Stop DB2.
Uninstall DB2 Enterprise.
/opt/ibm/db2/V9.7/install/db2_deinstall -a
exit
Install DB2 Express-C without creating any users, etc.
Update the instance with the new edition information.
You might encounter this error.
SQL5043N Support for one or more communications protocols
failed to start successfully. However, core database manager
functionality started successfully.
Look up your DB2 TCP/IP service name. It should be similar to db2c_db2inst1 where db2inst1 is the instance owner.
Make sure it’s set correctly in the DB2 configuration.
Start DB2.
You should now have a working DB2 Express-C installation with all the same databases.
Enable NFS services for HADR
You might need to enable network file system (NFS) services when configuring the High Availability Disaster Recovery (HADR) or Database Partioning (DPF) DB2 features. For example, with HADR, you might want to set up a slave database that shares a backup with the master database through NFS.
These commands should enable NFS services on most distributions of Linux:
sudo /sbin/chkconfig nfslock on
sudo /sbin/chkconfig rpcgssd on
sudo /sbin/chkconfig rpcidmapd on
sudo /sbin/chkconfig portmap on
sudo /etc/init.d/iptables restart
sudo /etc/init.d/nfslock restart
sudo /etc/init.d/portmap restart
sudo /etc/init.d/nfs restart
Some of the services might not exist on your distribution. Additional steps may be needed.
IBM Smart Business Cloud for Test & Development might be one of the environments where you’d have to do this.
Remove Facebook suggestions
One of the Facebook annoyances that cannot be disabled is the list of people that you don’t want to friend and whose walls you don’t want to write on that is in the the top right corner of its front page.

It’s easy to hide this impertinent design element.
On Firefox, you should install the Stylish extension.
On other browsers, you should follow the respective instructions.

Once you have Stylish installed:
1. Go to Facebook
2. Click on the Stylish icon in the status bar
3. Choose Write new style > For facebook.com

In the dialog:
1. Name the new style “Facebook”
2. Paste in the following code:
#pymk_hp_box {
display:none !important;
}
You should be able to save now and no longer be subjected to the Facebook Suggestions box. Unfortunately, this code may not survive the inevitable Facebook layout change.
Technical note: The wrapping code that you see in the screenshot above was generated by Stylish and will likely only work in Firefox. If you wish to adapt it in a different browser, you may want to replace the @-moz-document with @-o-document (for Opera), @-webkit-document (for Safari and Chrome), or @document once CSS3 is ratified and vendor-specific implementations merge.
Links
- Stylish extension for Firefox
- UserStyles.org
- About.com on user stylesheets (somewhat old)
iptables pitfall
An important thing to remember about rulesets in /etc/sysconfig/iptables is that they are chains. The first rule is applied, followed by the second, and so on. It’s the opposite of CSS that way. More specific rules should go first, while all-encompassing rules should go last.
I was trying to open the usual DB2 ports on RHEL. For some reason, nothing was working.
It turned out that this line was at fault:
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
This rejects all incoming traffic not otherwise allowed. The line has to go last in the file, after all the open port definitions.
CASCON Deploying MediaWiki with DB2 in the Cloud workshop
I’m hosting a workshop today at CASCON. The resources for it are below.
Materials
- Presentation (PDF, Slideshare)
- Exercises (PDF, Slideshare)
Resources
- IBM Smart Business Develop & Test on IBM Cloud
- Amazon Web Services (AWS)
- Rightscale
- MediaWiki Manual: IBM DB2
Downloads
- MediaWiki 1.16 build with DB2 support
- IBM Data Server Driver for ODBC and CLI
- IBM DB2 Express-C – Free database server