Monday, November 27, 2006

Configuring DB2 V8.2 for local usage...but logging in with...

It was snowing heavily last night here at Vancouver. I had a feeling last night that I would stay at home working today. This morning I tried to drive to the main road (which should be safe for the people who do not have 4X4), but after several attempts I quitted. I then stayed at home and continued on my work at 7:30 am in the morning!

Later in the afternoon I needed to install DB2 V8.2 to my laptop. I just installed from a DVD which is a PE. After the software installation I just got stuck in the fixpack installation. After several rounds of investigation, thank God that finally I got the thing solved. It's so funny that I somehow realized it should be a bug in the fixpack installer.

After that I am ready to create my database. However, I got a SQL1092N error!

SQL1092N "DAIPOK" does not have the authority to perform the requested.

I was like full of question marks, and began to go back to the fundamentals. I checked that I was in the group of DB2ADMNS already. I then began my several rounds of googling, and nothing interesting and relevant returned !

I started to figure out that the id that I put to DB2ADMNS was actually my LOCAL id. I logged off from my domain, and logged in as local. I could create a database no problem. However, if I wanted to create a database when I logged onto the domain, I got that scary error again. I figured out that my database creation should only need to be done one time, so I decided to log on as local to create it. My stupidity as a drilling I.T. Specialist told me not to avoid the problem, but faced it with pride. I spent an hour doing some research on the web, and came across this article written by an IBMer:

How To Develope DB2 Application on an airplane


Man! This article rocks! Don't get into the detail (if you are busy) but just scroll way down to the bottom:

db2set DB2_GRP_LOOKUP=LOCAL,TOKENLOCAL

You can also do it through IBM DB2->Set-up Tools->Configuration Assistant->DB2 Registry.

Kudos to Leon! However, I want to suggest him to change the blog title. The title misled me to think he's creating a database application for an airplane -__-". May be it's just my English problem. :)

Friday, July 28, 2006

Wizard, tutorial...more obstacles

My quest to expand my knowledge on web development continues. Yesterday I was trying the tutorial that bundles with RSA, it is called "Display dynamic information on Web pages with JavaServer Faces". The tutorial is straightforward and fun. Technology has improved so much. It becomes a fun thing when an user just needs to create simple web application (comparing to the old school way where we needed to program our servlet, beans, JSP, JSP Tags and HTMLs....just for firing up a simple web application). With all the widgets in the palette, creating a high-level becomes drag-and-drop. I am pretty amazed by how the database connection is handled. It was a fun learning experience.

However, I got so stuck in one of the sections. It is section 2.5 - Using automatic key generation. I spent so much time on this section, but I still could not fetch the right key from the database. I spent a lot of time reading the code, but then I found out the code generated from wizards is no longer under my control. The code looks so delicate that I did not know what I could do to make stuff work. Eventually I had to read the help contents of automatic key generation from RSA.

Based on the tutorial, when one wants to use automatic key generation, they just need to double click the relational record in Page Data view, go to Key Generation and specify the appropriate parameters. What I find out is that this process only will change a XML file under WEB-INF/wdo (the metadata file that is related to the relational record); however, this process will not add a piece of decisive code into the PageCode of the JSP, which is:

autoGenerateKey(create_record,
getCreate_recordMediator(),
getRealPath(create_record_metadataFileName));

In order to generate this segment, either I can put it in manually, or if I use the relational record wizard, what I can do is to select "Auto generate key" in the "Advance tasks" when I am at the "Column Selection and Other Tasks".

I am not being negative, it's just that wizards and code generation somehow can become a nightmare to programmers. When we find that something do not work, we do not know whether it's our code, or it's the complicated code that was generated. Secondly, it's often a challenge to see things don't work after following closely to a tutorial. I hope that my sharing here can help other people. :)

Monday, June 26, 2006

Ouch! Took me a day to resolve the webservice client issue!

Recently I started to look into web service and all the nice binding tools with Swing components. I found that there's a nice tutorial in Rational Software Architect which is thorough and interesting. I started on it yesterday, and got stuck for the whole night and almost the whole day today (well, I am on a project, and this knowledge can be helpful to my project. Hopefully I don't sound like I have nothing else to do!).

The reason it took me so long is because I just cannot get the data back. My application looked DEAD. I then opened the TCP/IP monitor, and found that there's no traffic. The problem is I did not know whether I did something wrong in the binding, or the component is not firing off request whatsoever. I was in a very difficult situation because I am not familiar with the binding, nor I am an expert in webservices. I was at a point that I started to suspect whether the webapp is written correctly. I looked through the code in the webapp, but it did look perfectly fine!

Finally I had to debug the wizard-generated glue code for my client application step by step, until I found out an exception which is described here. After I added the jar back to the classpath of my little application, it then works fine. YEAH! It's one of a kind learning experience, and I hope my experience helps my other teammates who will be using web services and run against WTE 6.0.2 :)