Wednesday, February 13, 2013

DB2 database setup

Did you ever have to setup DB2 on your local machine? You will find that if you have domain user, things are not as straight forward as they might seam. Here is a little help for DB2 Express 10.


I was using Windows 7 64 bit for this.

If you are logged in domain and what you found on IBM help site does not work, you might try this (You will need to run Command window - Administrator):

1. Create same username as domain username using local account.
2. Create new group DB2ADMNS
3. Add all usernames (domain,local and db2admin) to Administrators and DB2ADMNS
4. Run db2set DB2_GRP_LOOKUP=LOCAL,TOKENLOCAL
5. Run DB2STOP
6. Run DB2 UPDATE DBM CFG USING SYSADM_GROUP DB2ADMNS
7. Run DB2START
8. And now, the important step that I always forget, logoff and logon with your username. You should be able to do administration tasks now.

You can now create database:
attach to db2 user <username>;
create database <dbname>;
connect to <dbname>;
create bufferpool bpool8k size 20000 pagesize 8k;
create tablespace tbsp_8k pagesize 8k bufferpool bpool8k;

That's it. You can use your favorite tools now to create tables and run scripts.

Regards

Saturday, February 02, 2013

JDeveloper overview

Until recently, I was never a big fan of the visual tools like JDeveloper concerning Web UI development, but my recent exposure has changed my mind. Being a hard core developer was always something that had to go along with Java development or at least I though so. Great platform, but too much choice and somewhat looser restrictions in terms of what needs to be used and in which way (just remember trying to implement Web Services before JEE 5 with different tools...). JEE is only defined by its specification and it is a recommendation to be followed by many (see Wiki). Even then, some things are easily done but others are not.

JDeveloper (version 11.1.2.3.0) is, I have to say, a complete tool for the application development especially if you are developing for WebLogic server   (server is integrated into JDeveloper as test platform). You can of course use other vendors too and there are half a dozen of them. ADF Fusion comes certified for the WebLogic, WebSphere, Tomcat and JBoss (look here). We were building an ADF Fusion Application (so primary components like ADF Faces and ADF BC) and I have to say that I was impressed by the quality and the speed of the application that I could write in about 30 minutes. There is no way to achieve that kind of productivity with most other JSF related tools. There are some restrictions that you might not like (like overuse of XML and proprietary format of the JDeveloper for ADF part of the application) but overall, there is a lot of help available on the Oracle site. After a while you will get used to thinking XML and debugging XML (at first I though, how in the world can I debug XML...). You can still keep faces-config but moving to ADF implementation (adfc-config) offers much more choice and it is default for the Fusion framework.

In case that you are considering this tool, here are a few benefits that I could come up with:

  1. Full JEE support for the projects including EJB, WS, ADF BC, ADF Faces, JPA and other (and when I say other I mean that it has more than 170 types of items that you can create in different projects).
  2. One of the biggest advantages is that it offers a full RAD environment regarding JSF applications and it is pretty much the only tool to do so. This however comes with a price of needing to expose model as Data Control to fully utilize truly rapid creation of the visual components (and this is for the elements not coming from ADF BC).
  3. Even though I would consider overuse of XML something that is definitely not a benefit, exposing a ton of values through properties is one of the things that this approach has enabled. You can still expose Java methods for every control should you need it. Once you understand a bit on how exactly internals of the BC are working, it will not be to difficult to create effective controls.
  4. Drag and drop functionality for JSF (ADF Faces) works like a charm. Very precise, looks the same way in the design as it will be in the run-time and has a ton of options over JSF.
  5. Tool itself has a very good Database Navigator and can display UML diagrams, database table relationships, ADF flow and bunch of other productivity features.
  6. For ADF Faces, it has more than 150 components that you can use.
  7. Creating WS is super easy and exposing it through the controls is just a few clicks away.
  8. Productivity features for LOVs based on ADF BC are simply amazing. You can create drop down lists and search dialogs that are very usable with only few clicks and few lines of code.
  9. Help for the usage of the product is outstanding. I found that when trying to use property or already existing control, it is very easy to find some help by not even searching and only using F1.
  10. Adding new field for already existing database control is very easy and it takes only few minutes to update controls in the model and in the UI layer.
  11. It has a really nice support for mobile devices where you can create the application for desktop and mobile with just a few minor changes and a thoughtful design.
  12. A great control over task flows that you can visually develop (adfc-config). A lot of extensions over faces-config.
  13. JDeveloper site has Learn More tab where you can find a lot of examples in the PDF format or video.

Of course, no tool comes perfect, so here are few items that I did not like:

  1. Even though it is a free tool, to deploy ADF Fusion project you need to pay for the license if you do not already have one for WebLogic server.
  2. Tool uses a lot of memory to operate.
  3. Sometimes can be very slow (especially if you are running it on 32-bit machine with database deployed on the same machine).
  4. Debugging in XML is not something I am used to and in some cases it is a bit difficult, even though you have ADF Data and Structure tabs for debugging to see what ADF variables are and you have EL evaluator (it seems to me that too much data is proxied and used through the reflection).
  5. ADF Faces components are based on the Apache MyFaces Trinidad controls and that sometimes makes it a bit hard to extend (successful in the end, but it took some time). At least I found it to be very complex to understand models behind the controls. You can try for example, to create custom data-table that is based on the WS call and not database control (ADF BC) and that has ability to filter, sort and paginate, and you will understand what I mean.
  6. Pagination in the data table is something that I personally do not like as it implements scrollable set (Idea sounds cool, but when you try customizing it, it is a hell to synchronize).
  7. Help for creating custom controls is not so great. I had some difficulties finding good samples of the things that I tried to accomplish.

Overall, for a big projects and a lot of team members where streamlined development is a must, JDeveloper will come as a great recommendation. It is a balanced tool that is great if you want use things out of the box, but if you need to customize it a lot or use components from other vendors, I would not recommend it.

To help you further, I can recommend a few resources:

Oracle ADF Real World Developer's Guide from Jobinesh Purushothaman is a great book that is offering insight into inner workings of the Oracle ADF framework. This is not a beginners book and you need to know some basics to fully benefit from reading it. You can get the book here.


Quick Start Guide to Oracle Fusion Development: Oracle JDeveloper and Oracle ADF from Grant Ronald if great introductory book that you might want to read before you start working with ADF Fusion application. You can get the book here.





If you are looking for a videos or PDFs, JDeveloper Learn More tab will offer you plenty of resources. A great deal of videos are posted on YouTube by Shay Shmeltzer. These videos will give you a great overview of capabilities of the JDeveloper and ADF framework.

Please let me know if you have any other great resource that might help potential user to understand ADF and JDeveloper a bit better.

Thanks.

Books 1

If you love technothrillers like I do, I would like to recommend a few books for the reading while you are riding a train or waiting in the doctors office (e.g.). So here is my list:

[Little Brother] Cory Doctorow is outstanding writer that can create atmosphere and keep it to the very end. Little Brother is a great story that describes an unfortunate moment  in time of a life of a teenager Marcus. Some interesting technology and look into problems that Marcus will face will keep you reading this book until very end. You can buy this book here.

Marcus, a.k.a “w1n5t0n,” is only seventeen years old, but he figures he already knows how the system works–and how to work the system. Smart, fast, and wise to the ways of the networked world, he has no trouble outwitting his high school’s intrusive but clumsy surveillance systems.


[Daemon] Daniel Suarez is now one of my favorite writers! An amazing book, probably one of the best I have read. You simply cannot pass this title. Technology, story, characters and just about everything in this book is well though of. A bit slow in the beginning, but later on it picks up. You can buy this book here.

When a designer of computer games dies, he leaves behind a program that unravels the Internet's interconnected world. It corrupts, kills, and runs independent of human control. It's up to Detective Peter Sebeck to wrest the world from the malevolent virtual enemy before its ultimate purpose is realized: to destroy civilization... 


[Freedom] Sequel to Daemon, this book brings a conclusion to the story. Perhaps even better than it predecessor. If you liked the first one, you simply cannot pass reading this one. You can buy this book here.

In the opening chapters of Freedom(tm), the Daemon is firmly in control, using an expanded network of real-world, dispossessed darknet operatives to tear apart civilization and rebuild it anew. Soon civil war breaks out in the American Midwest, in a brutal wave of violence that becomes known as the Corn Rebellion. Former detective Pete Sebeck, now the Daemon's most powerful-though reluctant-operative, must lead a small band of enlightened humans toward a populist movement designed to protect the new world order. But the private armies of global business are preparing to crush the Daemon once and for all. In a world of conflicted loyalties, rapidly diminishing human power, and the possibility that anyone can be a spy, what's at stake is nothing less than human freedom's last hope to survive the technology revolution.


[Digital Fortress] Dan Brown has a way of creating a great story and keep it interesting to the very end. If you like cryptography, you will love this book. You can buy this book here.
When the NSA's invincible code-breaking machine encounters a mysterious code it cannot break, the agency calls its head cryptographer, Susan Fletcher, a brilliant, beautiful mathematician. What she uncovers sends shock waves through the corridors of power. The NSA is being held hostage--not by guns or bombs -- but by a code so complex that if released would cripple U.S. intelligence. Caught in an accelerating tempest of secrecy and lies, Fletcher battles to save the agency she believes in. Betrayed on all sides, she finds herself fighting not only for her country but for her life, and in the end, for the life of the man she loves.

[Deception Point] Same as previous books from Dan Brown, this one has plenty of technology, science,  twists and to the very end reader will wonder who is the person behind the conspiracy! You can get the book here.

When a NASA satellite discovers an astonishingly rare object buried deep in the Arctic ice, the floundering space agency proclaims a much-needed victory -- a victory with profound implications for NASA policy and the impending presidential election. To verify the authenticity of the find, the White House calls upon the skills of intelligence analyst Rachel Sexton. Accompanied by a team of experts, including the charismatic scholar Michael Tolland, Rachel travels to the Arctic and uncovers the unthinkable: evidence of scientific trickery -- a bold deception that threatens to plunge the world into controversy. But before she can warn the president, Rachel and Michael are ambushed by a team of assassins. Fleeing for their lives across a desolate and lethal landscape, their only hope for survival is to discover who is behind this masterful plot. The truth, they will learn, is the most shocking deception of all.


That is it for now, I have a few more titles, but I should probably leave it for the next post...

Cheers!