iDatamining.org

I am looking for projects to work on
Please contact with me at yiyu.jia@iDataMining.org!

Tuesday, January 25, 2011

Windows 7 recovery and MBA fixing

I am unlucky! My laptop's hard driver is damaged when I tried to re-run assessment in my windows 7 and cancel it after I heard terrible strange noise coming out from my laptop. Probably, the hard drive has not been physically damaged. However, I can not read the data from this seagate 2.5" driver after i put it in an external USB or eSATA enclosure.

Anyway, I replaced a new 2.5" hard driver for my laptop. Before I restore Windows 7 system to the laptop, I installed Fedora on it to see if its motherboard has no problem. However, after doing this, Windows restore DVD (created by Gateway backup) can not recognize the right size of new hard driver. It always shows 0 size. Then, I do the following steps to restore the Windows 7,

1) put the hard driver into a external closure and connect to another Visa machine.

2) Using the Disk Management tool from Computer Management to format the new hard driver.

3) Put back the new hard driver and restore Windows 7 on the laptop.

4) However, the system can not been boot up yet. I have to continue work.

5) download and make a Windows 7 64 bit Recovery CD and run the below command to fix the MBA. Particularly, I have to add option "f" to successfully reset MBA.

bootsect.exe /nt60} C: /force] /mbr 

Friday, January 21, 2011

Did MySQL for IBM i5/OS platform die?

On Zend Forum, there is a hot discussion about MySQL announce EOL support for MySQL on IBM i. This is the link to Zend forum post. This is MySQL EOL announce. However, after reading those discussion, I feel some of them are worrying something which they do not need to worry about.

I think the EOL support only means that there will be newer version of MySQL for IBM i platform. It does not mean developer can not use existing latest version of MySQL on IBM i. The only thing missed  is that you can not BUY support from MySQL because they do not supply this service. However, will this be big issue? I do not think it is going to big problem because many people want to use MySQL because it is FREE. I think I will be happy with MySQL as long as its features are enough for my application and it is in a product quality.

So, I would like to ask people, who worry about the EOL support for MySQL on IBM i, to think about one thing. What do they want, always upgrading to latest version of MySQL or using one stable version to build their own product? Obviously, most of people's target is the second one: build their own application on top of free MySQL RDBMS. Therefore, I would like to say MySQL does not have its EOL on IBM i. Developers can still use it as long as they are satisfied with its quality and features.

I am interesting in MySQL on IBM i is because I am looking for a way to walk around the DB2 Connect license fee issue. To remotely connect to a IBM i DB2, developer need to buy DB2 Connect license from IBM if they are not using free type 4 JDBC library like jt400. Therefore, I am thinking that let PHP script to remotely connect to MySQL server with DB2i storage engine might be a good way to walk around this license issue. With this solution, PHP can write and read data which is stored in DB2. And the data can be subsequently accessed from DB2 side like RPG programm. But, the limitation will be that developer can only write stored procedure in MySQL and this stored procedure can be remotely accessed by PHP through MySQL interface.

Wednesday, January 19, 2011

Some notes about QSQSRVR job on IBM i5 OS V5R4


QSQSRVR runs in subsystem QSYSWRK. But, with "V5R4 PTF—SI33298" or "V6R1 PTF—SI33949", it is possible to configure QSQSRVR to run in different subsystem. I copied some commands here for my convenience.

There are two ways to request to use SQL Server Mode in programm. One is, in SQL CLI API, call SQLSetEnvAttr() via the SQL_ATTR_SERVER_MODE attribute. The other is using QWTCHGJB() Work Management API, via the "Server mode for Structured Query Language" key 1922 within the JOBC0200 format.

By default, five QSQSRVR jobs are active. Two more QSQSRVR jobs will be created if fewer than jobs are unused. The following command is to increase the initial number of jobs, threshold, and job number increasing interval.
CHGPJE SBSD(QSYS/QSYSWRK) PGM(QSYS/QSQSRVR)

Management Central starts 18 SQL Server Mode connections. Each of the two servers (QYPSSRV and QYPSJSVR) currently establishes nine connections with a QSQSRVR job to process its SQL requests to these databases. The following commands are used to find the controlling job:

1)Using command line: WRKJOB JOB(QYPSJSVR/QYPSJSVR)
2)Or using iNavigator: Work Management --> Subsystem --> Active Subsystems --> Qsyswrk
3)Using SQL monitor: STRDBMON OUTFILE(MYLIB/QSQMON1) JOB(*ALL/*ALL/QSQSRVR)

In order to run QSQSRVR job in same subsystem as application runs, we need to do following steps,

1)install PTF—SI33298 for i5 OS V5R4 or PTF—SI33949 for i5 OS V6R1. Use command WRKPTFGRP to list all installed PTF.

2) set environment variable QIBM_SRVRMODE_SBS to be "*SAME" or "". Here is the command to add this environment variable, ADDENVVAR ENVVAR(QIBM_SRVRMODE_SBS) VALUE('*SAME') LEVEL(*SYS). To remove environment variable, command RMVENVVAR is used.

Finally, can I use this to optimize Web application running inside Zend server? It seems I can not because the QIBM_SRVRMODE_SBS environment variable is ignored whenever the name of the application subsystem is 'QHTTPSVR' or 'ZEND'. However, this environment variable should be seen in subsystem where application use native JDBC driver to connect to DB2. PHP db2 extension and native JDBC driver (in IBM Java toolkit) connect to DB2 through DB2 SQL server mode. Using DB2 SQL Server Mode, each connection has a QSQSRVR job. QSQSRVR job inherits attributes user profile and running priority from connection request initializing.

references
1) DB2 for i5/OS: SQL Server Mode Primer
2) TechTip: Grab Control of the DB2 QSQSRVR Jobs

Monday, January 10, 2011

Installing activeMQ on IBM i5 V5R4

The project I am working on is written in PHP. Since it is a B2B web service, I want my application to write down both system level log and application level log as much as possible. Then, somebody can analyze the log when they want to.

However, as well known, an I/O operation is a time consuming operation. Obviously, I do not want this logging function will significantly slow down my application. Therefore, I design a asynchronous model to write logs. In order to be asynchronous, I have two choices. The first is multi-threaded. The second is messaging queue. Since PHP does not have built-in support for multi-thread and PHP is stateless, I choose Messaging Queue. I used to lead on migrating from Sonic MQ to ActiveMQ for a ETL engine project. So, I decide to give it a try on IBM i i5 V5R4 platform.

On IBM i i5 V5R4 platform, I have JDK 1.5 32bit, which is IBM J9 VM. Below is the steps I install activeMQ on IBM i5/OS V5R4,

1) run command call qp2term to open a i5/OS PASE terminal session.

2) run java -version to check the JDK version.

3) run export JAVA_HOME=/QOpenSys/QIBM/ProdData/JavaVM/jdk50/32bit to set this session's JAVA_HOME to point to JDK1.5 . or, call command CHGENVVAR ENVVAR(JAVA_HOME) VALUE('/QOpenSys/QIBM/ProdData/JavaVM/jdk50/32bit') to modify the JAVA_HOME environment if i have not in PASE environment. or use ADDENVVAR to add the environment.

4) run java -version to check the JDK version again to make sure your using JDK 1.5 now.

5) Go to http://activemq.apache.org/ and download activeMQ distribution for Unix/Linux/Cygwin platform. I downloaded version 5.4.2 .

6) using 7zip to unzip the file to be a TAR file as I can not use -z option with tar command in PASE environment on i5/OS.

7) copying the tar file under my home directory on i5/OS via IFS.

8) running command tar -xvf apache-activemq-5.4.2.tar

9) cd into directory "apache-activemq-5.4.2" and run command ./bin/activemq to start up activemq with default configuration.

10) Since I can not control i5/OS and the PASE terminal emulator might has problem with character schema used by JDK in default. I choose to test this activemq instance from my PC workstation.

11) Download and install activemq zip format distribution.

12) set the JAVA_HOME environment properly from either Windows system environment variable setting or adding set JAVA_HOME=%your jdk home directory% into BATCH files.

13) Download and install apache ANT and add ANT bin directory into Windows PATH environment.

14) In windows command prompt window, go to activemq example directory and run command ant producer -Durl=tcp://your_i5_host:11616 to send sample msg into activemq testing channel.

15) In windows command prompt window, go to activemq example directory and run command ant consumer -Durl=tcp://your_i5_host:11616 to consume sample msg inside activemq testing channel.

After the last two steps is successful, I know I can use activeMQ on i5/OS. Although this is not a installation for product environment, it shows me how to install activeMQ under my home directory as developing environment.