Install
* Login as root.
* Create groups:
o groupadd -g 999 db2iadm1
o groupadd -g 998 db2fadm1
o groupadd -g 997 dasadm1
* Create users for each group:
o useradd -u 1004 -g db2iadm1 -m -d /home/db2inst1 db2inst1
o useradd -u 1003 -g db2fadm1 -m -d /home/db2fenc1 db2fenc1
o useradd -u 1002 -g dasadm1 -m -d /home/dasusr1 dasusr1
* Set password for each users created:
o passwd db2inst1
o passwd db2fenc1
o passwd dasusr1
* cd to installation file directory:
o Example: /tmp/db2/exp/disk1
* Run installation script:
o ./db2_install.sh
Post Install
* Login as root.
* Install license (example):
o /opt/ibm/db2/V9.1/adm/db2licm –a /tmp/db2/exp/disk1/db2/license/db2exp_uw.lic
Create the DB2 Administration Server (DAS)
* Login as root.
* Create DAS with dasusr1
o /opt/ibm/db2/V9.1/instance/dascrt -u dasusr1
* Login as dasuser1
o Start the DAS: db2admin start
* Optional: to enable autostarting of the DAS upon reboot
o /opt/ibm/db2/V9.1/instance/dascrt/dasauto –on
Create DB2 instance
* Login as root.
* Create instance with users db2fenc1 and db2inst1:
o /opt/ibm/db2/V9.1/instance/db2icrt -a server -u db2fenc1 db2inst1
* Optional: enable autostarting of the db2inst1 instance
o /opt/ibm/db2/V9.1/instance/db2iauto –on db2inst1
Update environment variables
* Example:
* Login as db2inst1
* edit .bash_profile
o vi /home/db2inst1/.bash_profile
o insert the following line at the end of the file – “. /home/db2inst1/sqllib/db2profile”
* Do the same for dasusr1, using its corresponding directory.
Database service
* Login as root:
* Add new service entry:
o vi etc/services
o insert this line “DB2_TMINST 50000/tcp” at the end of the file
Verification
* Login as db2inst1
* List installed DB2 products and features: db2ls
* Display the default instance: db2 get instance
o Result: The current database manager instance is: db2inst1
* Start the database instance: db2start
o Result: SQL1063N DB2START processing was successful.
* Stop the database instance: db2stop
o Result: SQL1064N DB2STOP processing was successful.
Thursday, July 10, 2008
DB2 Manual Installation on Linux
Posted by Prem Kumar Jha at 11:44:00 PM 0 comments
Labels: DB2
Sunday, July 6, 2008
Why to stay alone atleast once in bachelor life
After a long time I feel, I need to write why I love to stay alone. Many friends asked me why r you staying alone?, are you not bored to be alone. One of my collegues ask me again few days back the same question. So, to answer everyone seprately, I thought it's good if nxt time any body will ask I will pass my blog's link.
I think everyone should live alone atleast for few months and see.
Its certainly a different experience. Though there wont be any company when we need it and things like that, the freedom it offers is amazing.
Living with someone or a group is good in its own way. But there is always somebody else to consider. Even when you are not hungry enuf, you got to do stuff for the other person, you just cant sit and see that the other person’s working and all that. When you are alone, The house is all yours. You can eat when you want, you can take bath when you want, its all you..You are the sole custodian for the Remote control and what not.
You can just lie around and do nothing, or get creative and do stuff without any inhibitions. There is no one to comment, judge or criticize. It is truly your Home, where you don’t have to answer anyone. Ofcourse in our mind, our parents are gonna criticize how we are keeping the house and what not, but you can atleast try to ignore it, when its in your head.
Through out our School, College life either we live with our Parents or Hostel or with your roommates, so there is always rules to follow. I mean, somebody else’s rules. When we start earning and stuff, we can have our own rules based on our values. Its fun having roommates when your frequency aligns. Otherwise it’s a royal pain, everybody knows that. I have had my share of my roommates during college time. Sometimes it was fun, sometimes it wasn’t.
I had to stay alone for a year, few years back. There was no company. I had never even slept alone in a room before that. I am so tuned into all these ghost and stuff, sleeping alone was an impossible task for me. So I was kinda scared about staying alone. So initially, I used to sleep with Bedroom light on and slowly I learned to sleep with just a night lamp. Daytiem, it was never a problem for me. Dark scares me..Sometimes, I missed company. But I really started enjoying it. It was fun. Weekends, sleep late, wakeup around noon, eat take outs and cook sometimes if I feel like it, read lots and lots of books, no need to worry whether I am disturbing somebody with my crazy habits, I totally enjoyed it.
I am not talking against staying with Roommates and all.. I know lot of people enjoy that. I am just saying it’s a good experience to have, to stay alone for sometime and see..
After Marriage, its not possible. You cant stay alone and spend your parent’s money either. So all we have is that small period, where we earn and can be financially independent and unmarried. Ofcourse, staying alone in old age is not that good. There are lots of disadvantages in living alone, when you are old. So, that’s ruled out, I mean if we have the choice.
One main disadvantage in staying alone though, People tend to become loners..
There are other many good factors which forced me to stay alone. So, stay tune for other good new factors ......
prem
Posted by Prem Kumar Jha at 10:06:00 AM 0 comments
Labels: Stay Alone
Monday, April 14, 2008
ONE BEDROOM FLAT
ONE BEDROOM FLAT...
WRITTEN BY AN INDIAN SOFTWARE ENGINEER......
As the dream of most parents I had acquired a degree in
Software Engineering and joined a company based in USA, the
land of braves and opportunity. When I arrived in the USA, it
was as if a dream had come true.
Here at last I was in the place where I want to be. I decided I
would be staying in this country for about Five years in which
time I would have earned enough money to settle down in India.
My father was a government employee and after his retirement,
the only asset he could acquire was a decent one bedroom flat.
I wanted to do some thing more than him. I started feeling
homesick and lonely as the time passed. I used to call home and
speak to my parents every week using cheap international phone
cards. Two years passed, two years of Burgers at McDonald's and
pizzas and discos and 2 years watching the foreign exchange
rate getting happy whenever the Rupee value went down.
Finally I decided to get married. Told my parents that I have
only 10 days of holidays and everything must be done within
these 10 days. I got my ticket booked in the cheapest flight.
Was jubilant and was actually enjoying hopping for gifts for
all my friends back home. If I miss anyone then there will be
talks. After reaching home I spent home one week going through
all the photographs of girls and as the time was getting
shorter I was forced to select one candidate.
In-laws told me, to my surprise, that I would have to get
married in 2-3 days, as I will not get anymore holidays. After
the marriage, it was time to return to USA, after giving some
money to my parents and telling the neighbors to look after
them, we returned to USA.
My wife enjoyed this country for about two months and then she
started feeling lonely. The frequency of calling India
increased to twice in a week sometimes 3 times a week. Our
savings started diminishing.
After two more years we started to
have kids. Two lovely kids, a boy and a girl, were gifted to us
by the almighty. Every time I spoke to my parents, they asked
me to come to India so that they can see their grand-children.
Every year I decide to go to India… But part work part
monetary conditions prevented it. Years went by and visiting
India was a distant dream. Then suddenly one day I got a
message that my parents were seriously sick. I tried but I
couldn't get any holidays and thus could not go to India ... The
next message I got was my parents had passed away and as there
was no one to do the last rights the society members had done
whatever they could. I was depressed. My parents had passed
away without seeing their grand children.
After couple more years passed away, much to my children's
dislike and my wife's joy we returned to India to settle down.
I started to look for a suitable property, but to my dismay my
savings were short and the property prices had gone up during
all these years. I had to return to the USA...
My wife refused to come back with me and my children refused to
stay in India... My 2 children and I returned to USA after
promising my wife I would be back for good after two years.
Time passed by, my daughter decided to get married to an
American and my son was happy living in USA... I decided that
had enough and wound-up every thing and returned to India... I
had just enough money to buy a decent 02 bedroom flat in a
well-developed locality.
Now I am 60 years old and the only time I go out of the flat is
for the routine visit to the nearby temple. My faithful wife
has also left me and gone to the holy abode.
Sometimes
I wondered was it worth all this?
My father, even after staying in India,
Had a house to his name and I too have
the same nothing more.
I lost my parents and children for just ONE EXTRA BEDROOM.
Looking out from the window I see a lot of children dancing.
This damned cable TV has spoiled our new generation and these
children are losing their values and culture because of it. I
get occasional cards from my children asking I am alright. Well
at least they remember me.
Now perhaps after I die it will be the neighbors again who will
be performing my last rights, God Bless them.
But the question
still
remains 'was all this worth it?'
I am still searching for an answer.................!!!
START THINKING
IS IT JUST FOR ONE EXTRA BEDROOM???
LIFE IS BEYOND THIS …..DON'T JUST LEAVE YOUR LIFE ……..
START LIVING IT …….
LIVE IT AS YOU WANT IT TO BE …….
Posted by Prem Kumar Jha at 3:54:00 PM 0 comments
Labels: Article
Friday, April 4, 2008
What does volatile do?
What does volatile do?
This is probably best explained by comparing the effects that volatile and synchronized have on a method. volatile is a field modifier, while synchronized modifies code blocks and methods. So we can specify three variations of a simple accessor using those two keywords:
int i1; int geti1() {return i1;}
volatile int i2; int geti2() {return i2;}
int i3; synchronized int geti3() {return i3;}
geti1() accesses the value currently stored in i1 in the current thread. Threads can have local copies of variables, and the data does not have to be the same as the data held in other threads. In particular, another thread may have updated i1 in it's thread, but the value in the current thread could be different from that updated value. In fact Java has the idea of a "main" memory, and this is the memory that holds the current "correct" value for variables. Threads can have their own copy of data for variables, and the thread copy can be different from the "main" memory. So in fact, it is possible for the "main" memory to have a value of 1 for i1, for thread1 to have a value of 2 for i1 and for thread2 to have a value of 3 for i1 if thread1 and thread2 have both updated i1 but those updated value has not yet been propagated to "main" memory or other threads.
On the other hand, geti2() effectively accesses the value of i2 from "main" memory. A volatile variable is not allowed to have a local copy of a variable that is different from the value currently held in "main" memory. Effectively, a variable declared volatile must have it's data synchronized across all threads, so that whenever you access or update the variable in any thread, all other threads immediately see the same value. Of course, it is likely that volatile variables have a higher access and update overhead than "plain" variables, since the reason threads can have their own copy of data is for better efficiency.
Well if volatile already synchronizes data across threads, what is synchronized for? Well there are two differences. Firstly synchronized obtains and releases locks on monitors which can force only one thread at a time to execute a code block, if both threads use the same monitor (effectively the same object lock). That's the fairly well known aspect to synchronized. But synchronized also synchronizes memory. In fact synchronized synchronizes the whole of thread memory with "main" memory. So executing geti3() does the following:
1. The thread acquires the lock on the monitor for object this (assuming the monitor is unlocked, otherwise the thread waits until the monitor is unlocked).
2. The thread memory flushes all its variables, i.e. it has all of its variables effectively read from "main" memory (JVMs can use dirty sets to optimize this so that only "dirty" variables are flushed, but conceptually this is the same. See section 17.9 of the Java language specification).
3. The code block is executed (in this case setting the return value to the current value of i3, which may have just been reset from "main" memory).
4. (Any changes to variables would normally now be written out to "main" memory, but for geti3() we have no changes.)
5. The thread releases the lock on the monitor for object this.
So where volatile only synchronizes the value of one variable between thread memory and "main" memory, synchronized synchronizes the value of all variables between thread memory and "main" memory, and locks and releases a monitor to boot. Clearly synchronized is likely to have more overhead than volatile.
Posted by Prem Kumar Jha at 11:43:00 PM 0 comments
Labels: JAVA
Saturday, March 22, 2008
why Swing is not thread safe and AWT is
Simple answer is - "that's the design choice the Swing team made". It is a well-known fact that writing thread safe API/library is more difficult and inefficient.
So to simplify the implementation of Swing library they chose it to be not thread safe. The argument being that most of the GUI related work happens in the callbacks from the GUI which happen on the single GUI thread anyways. Granted - for long running tasks the user will have to do more work if he/she wants to do multithreaded activity. Not making Swing thread safe allowed them to implement the Swing which covered a lot more ground (new controls, layouts, keyboard actions, layered pane etc) in a short amount of time.
It is not that bad though - Swing does provide a mechanism to deal with the issues of threading -
javax.swing.SwingUtilities.invokeLater(Runnable ...);
javax.swing.SwingUtilities.invokeAndWait(Runnable ...);
javax.swing.JProgressBar class
javax.swing.ProgressMonitor
javax.swing.ProgressMonitorInputStream
SwingWorker
For more explaination of why they made that decision please see the following URLs:
http://java.sun.com/products/jfc/tsc/articles/threads/threads1.html
http://java.sun.com/products/jfc/tsc/articles/threads/threads2.html
http://java.sun.com/products/jfc/tsc/articles/threads/threads3.html
The AWT is based on the OS's WIndowing System's peer objects which are inherently thread safe. That is why AWT is thread safe.
One can argue though that they should have provided factory methods (similar to collections framework) or subclasses to get thread safe versions of the Swing classes - for example, TSJTextField or TSJTree where the "TS" stands for 'thread safe'
Posted by Prem Kumar Jha at 9:51:00 PM 0 comments
Labels: JAVA