Thursday, March 13, 2008

Important Tip for Clustered OracleAS 10.1.3.3.0

by Eduardo Rodrigues

Hi everybody!

Recently we've upgraded OracleAS environments in one of our biggest clients here in Brazil from version 10.1.3.0.0 to version 10.1.3.3.0. To do that, we've applied patchset #6148874 (which can be downloaded from Oracle Metalink) carefully following all the instructions found in its installation guide. As expected, the patchset application went perfectly fine and all of our configured containers and applications were still there, up and running, and everybody was happy... until we noticed that one of our oldest and most annoying problems was still there: using ASControl to manage our clustered production environment sometimes was just impossible due to its unacceptable performance when trying to access anything in cluster topology context.

Unfortunately, the only workaround we knew was to restart ASControl application in the cluster's "master node" (the node elected to run the ascontrol application). Fortunately, today I found the problem and also the solution for this situation.

There's a documented bug on Metalink (bug #6601697) explaining that this problem is caused by the underlying RMI communication between the ASControl 10.1.3.3.0 and the other components of the cluster. ASControl uses RMI protocol to connect to other nodes, makes some request and then waits for a response. The problem is that there's no timeout for this response waiting. If one or more components are in a heavy load situation, for example, ASControl will keep waiting for their responses, which can take too long, causing the impression that ASControl stopped working.

In fact, this problem is known since version 10.1.3.1.0 but it seems that patchset 10.1.3.3.0 does not include the correction as it should. So, for now, the solution is to apply the one-off patch #6124143, also found on Metalink. This patch is originally targeted to OracleAS 10.1.3.1.0 but, as written in bug #6601697, it's ok to apply it on version 10.1.3.3.0 though. We just have to follow these simple instructions, found in the bug, before actually applying it:
  1. Edit the patch file etc/config/actions and replace 10.1.3.1.0 by 10.1.3.3.0

  2. Edit etc/config/inventory and replace 10.1.3.1.0 by 10.1.3.3.0

Once it's successfully applied, we must use ASControl to navigate to the OC4J instance where ascontrol application is running (typically the "home" instance). Click on Administration -> Server Properties -> Command Line Options -> Start-parameters: Java Options and add "-Drmi.client.connection.timeout=X", where "X" should be the number of seconds to wait for a RMI response before timeout. The bug suggests 5 seconds.

We've successfully applied this one-off patch in our OracleAS 10.1.3.3.0 environment and, until now, it seems to have solved the problem.

I feel this might be a problem faced by many other OracleAS 10.1.3 users so I hope this post can help them.

Cheers and... keep reading!

Friday, February 1, 2008

SCJP Group on LinkedIn

This one is for all Sun Certified Java Programmers out there.

You’re all invited to join the SCJP Group on LinkedIn. Joining will allow you to find and contact other certified members on LinkedIn. The goal of this group is to help members:

  • Reach other certified programmers

  • Accelerate careers/business through referrals from group members

  • Know more than a name – view rich professional profiles from fellow SCJP Group members

SCJP Group LogoClick here to join now!

Hope to see you in the group soon.

Cheers and keep reading...

Friday, January 25, 2008

Regular Expressions in Oracle Database 10g

by Fábio Souza

Hello everybody!

This is my debut post to Java 2 Go! (ironically it's not about Java) and I'm really happy for having been invited to write by Eduardo. I hope you will enjoy as much as I am!

As the title says, this is a short how-to about the use of regular expressions in Oracle Database. This feature was introduced in Oracle 10g and is really helpful, useful and, better off, not too complicated. Let's take a look.

There are three built-in SQL functions and one operator for working with regular expressions in Oracle 10g:
  • OPERATOR:

    • REGEXP_LIKE
      It's used in the WHERE clause with column filtering purpose. The filter is the informed pattern.

  • FUNCTIONS:

    • REGEXP_INSTR
      Returns the initial position where the informed pattern was found.

    • REGEXP_SUBSTR
      Returns the result of the informed pattern application.

    • REGEXP_REPLACE
      Replaces the informed pattern with another given string.

NOTE: pattern is the regular expression which is used to match specific regions of a string.

This example will show only the REGEXP_REPLACE function and the intention is to return only the value of field "Login".

-- Description:
-- First argument: string which the pattern will be applied to (it's possible to use a column instead).
-- Second argument: the pattern.
-- Third argument: new string that will replace the portion of the original string matching the given pattern.

select REGEXP_REPLACE(
   'ID = 13737009 - Login = T123456 - Status nonAdmin - WorkingPlace = HeadQuarter - Sector = B',
   '(.+)(Login = )([^ ]+)(.+)',
   '\3')
from dual;


The pattern used above defines four groups between parenthesis:
  1. "(.+)" matches 1 or more characters

  2. "(Login = )" matches the exact substring "Login = "

  3. "([^ ]+)" matches 1 or more character different from " " (space)

  4. "(.+)" again, matches 1 or more characters

In our example, the result for each group above is:
  1. "ID = 13737009 - "

  2. "Login = "

  3. "T123456"

  4. " - Status nonAdmin - WorkingPlace = HeadQuarter - Sector = B"

For the simple query above, the result of function "REGEXP_REPLACE" will be the replacement of the substring matching the given pattern with "\3". The presence of character "\" tells the function to replace "\3" with the substring matching the third group defined in the given pattern, which is "([^ ]+)". As you may notice, in this case, the given pattern matches the entire string so, at the end, the entire string will be replaced with "T123456".

Despite the beauty of this, there's one thing we should always keep in mind: performance. As we already know, applying functions to table columns in WHERE clauses typically makes Oracle's choice optimizer to ignore any index on that particular column which may result in a table full scan. If we're dealing with big volumes, this might be a huge concern. Thank God Oracle gives us some options like Partitioning and Parallel Queries.

That's all for now. If you'd like to get further information on the subject I recommend reading this article from OTN:

http://www.oracle.com/technology/oramag/webcolumns/2003/techarticles/rischert_regexp_pt1.html

Cheers! (and keep reading...)

New "acquisition"

Hi folks!

It's with the greatest satisfaction that I welcome the blog's most recent "acquisition": the Oracle consultant Fábio Saraiva de Souza. You may check his profile here.

Fábio is a good friend with whom I've had the opportunity to work for almost a whole year in my last project. As you will certainly notice, Fábio is one of that curious guys that are never satisfied until they really understand things to their deepest details.

Welcome Fábio! We'll be willing to read from you soon.

Tuesday, January 22, 2008

My favorite JDeveloper extensions

by Eduardo Rodrigues

Hi everybody!

You must have noticed that JDeveloper may be boosted by a great number of extensions provided either by Oracle itself or by an open source and partners community. If you did not noticed that yet, then you certainly should do so. Even if it's just for curiosity, you may check a complete list of all extensions available selecting the menu item "Help -> Check for Updates...".

It's important to say that for this feature to work properly, your JDev's web proxy configuration must be correct. So it's worth to take a look at this first by selecting menu item "Tools -> Preferences...":

Web proxy configuration

Now that we're all set, let's go back to the "Help -> Check for Updates..." thing.

On the wizard's first step you should make the following selection:

JDeveloper Update Centers selection

After pressing "Next" you'll be presented to a list of available extensions from the update centers selected before. Browse the list and see how many interesting and useful stuff you can add to your JDeveloper environment. All you have to do is to select the extensions you like and proceed with the wizard. After restarting JDeveloper will automatically install all downloaded extensions. I recommend that you always restart JDeveloper immediately when prompted to.

An alternative way to browse and download these extensions outside JDeveloper is to visit the following URLs:

In this case, to install them, use the feature "Install From Local File" in "Help -> Check for Updates..." wizard:

Installing an update from local file

As a suggestion, here is a list of my favorite extensions:
  • MUST HAVE

    • Oracle ADF SRDemo Applications
      Great way to learn ADF by example. Comes in 2 flavors: EJB 3.0 + Toplink Essentials JPA or ADF BC

    • Oracle ADF Developer's Guides Update

    • JDeveloper Spring 2.5 Support
      Adds support for creating and editing Spring 2.5 bean defintions. This addin will create the Spring 2.5 library and register the relevant XSDs and DTDs with the IDE to provide a productive editing experience for Spring definitions

    • Struts Documentation 10.1.3
      Complete Javadoc for Struts

    • Variable Highlighter Extension
      Dynamically highlights variables as you click on them

    • Subversion VCS Extension
      Much better version controller than plain CVS

  • USEFUL

    • JUnit Integration Extensions
      Various extensions providing integrated support for JUnit

    • Oracle JHeadstart Evaluation Version
      Oracle JHeadstart is a productivity toolkit that works on top of Oracle ADF. Using ADF Faces as View, JSF as Controller and ADF Business Components as Business Service, JHeadstart generates sophisticated ADF web applications using simple metadata. Generated features include wizards, shuttles, trees, list of values, multi-row insert/update/delete, advanced and quick search capabilities, file upload/download, deeplinking, conditionally dependent items, dynamic breadcrumbs and more.

    • Copy As HTML
      Great extension that makes the task of copying bits of source code to blogs much easier

    • XPath Search Extension
      Best way to search inside XML documents

    • Make Read-only Files Writable

    • GWT Developer
      Provides visual editing environment to help with developing with the Google Web Toolkit (GWT)

    • PMD JDeveloper Extension
      Provides integrated support for PMD 4.1

    • Remove Workspaces and Projects
      Adds a context menu option that allows the deletion of projects and workspaces and of their sub-contents, quick and easy.

    • Additional Skins for ADF Faces

    • Zipper
      This extension provides a simple ZIP feature for applications and projects

On the other hand, the extension "JDeveloper Keep Resident (for Windows only)" is definitely one that you should NOT use. That's an experimental extension, works only on Windows and the very same effect may be achieved in a much better way which has already been explained in a previous post.

Finally, if you want to contribute with your own great JDeveloper extension, you may install "JDeveloper Extensions SDK" which is an extension itself and includes documentation and sample extensions.

That's all for now.

Cheers and... keep reading!