Wednesday, July 25, 2007

What is an XA driver?

XA is a set of distributed transaction protocols defined by Open Group.
XA provide interfaces that could be used for cross platform transactions. Currently, much of the famous databases provided XA-compliant drivers. XA-compliant driver means that the transaction manager could send XA command directly to the driver.
Oops, sorry, in the world of distributed transaction, there are transaction manager and resource managers. Transaction manager coordinate the transaction, orchestrating the two-phase commit for each of the resource manager.
In JEE point of view, and transaction manager could be a type 3 JDBC driver, and the resource managers could be an XA compliant JDBC drivers, or general type 4 JDBC driver in which the type 3 JDBC driver will emulate XA command using common JDBC transaction commands.
In WebLogic console, when we setup a connection pool, usually we will be asked whether we want to assign an XA driver or just ordinary driver. XA drivers will have a significant overhead imposed into it, so make sure you only use the XA drivers when really required. It is common to have an XA-compliant version of connection pool and non-XA-compliant connection pool, both connecting to the same database, to avoid performance penalty when we don't need two-phase commit.
In my former company, we have a clustered WebLogic server installation with each of the databases have two pairs of connection pools, a non-XA and XA-compliant driver. Due to clustered environment, database connection are using RMI through JNDI lookup. For read only data, always use non-XA connection pool to increase performance.

Tuesday, July 24, 2007

Free and Unemployed

After admitted for work in Singapore, I resigned immediately because the employer asked me to start working ASAP. Singapore is a nice country to earn money, but I have a personal matters that pretty much the main reason to relocate there. The employer has been taken care of the EP application for me.
Yesterday I was called, suddenly the asked me to provide the translated academic transcript for the EP application. They said that this is not usually the case. Probably some kind of random sampling happened and it happened to be me that was chosen for the random checking. They already have some foreigners in the company, the procedure is a bit unusual.
I called to my campus. They told me that probably there is a delay in providing the translation of my academic transcript, due to the change of the rector of the University of Indonesia. Again, I lost my booked flight for the second time. What a waste of money.
Meanwhile, I'm free and unemployed now. Free zone..
Only for a while though...
This event also provides me with enough free time to explore, and accomplish things otherwise I couldn't do. Now I could read some old WebLogic texts, learn more the difference between type 3 and type 4 JDBC driver, and those kind of thingy... This time is a kind of retreat time, where you could do things you wouldn't have time to when you are engaged in an employment. I missed those time when I was as free as bird, when you become the business owner. But become an employee isn't a bad thing at all. You don't have to take just about everything, instead you could focus on things that you are best at.

Saturday, July 21, 2007

Intermittent problem with JRoller?

Today I found out this happening on our fellow JUG-ID JRoller blogs. The JRoller engine has been generated a script variable "$renderedText" instead of displaying the blog content. This suppose to happen temporarily, as the JRoller team pleaded they will fix it ASAP.

No INNER JOINs in Oracle 8i

Yesterday we encountered a problem when testing an already working version of our web application. The application works well in the development environment. When we move the application to hit the production database, it throws an exception.
The application uses Hibernate as its persistence manager. Our team has been hassled for quite some times, until one of our colleagues found out that the query produced by Hibernate was not runnable from Oracle's console. Digging further we found out that the database in production used an older version, the Oracle 8i. Oracle 8i does not support INNER JOIN syntax, therefore it rejects the query produced by Hibernate.
It came across my mind that we should change the dialect. If 8i does not support what is running on 9i, then the developer of Hibernate should have put different dialects for them. This is found out to be true. There is org.hibernate.dialect. Oracle9Dialect for Oracle 9i databases, and org.hibernate.dialect.OracleDialect for older Oracle 8i databases.
After we change it to the correct dialect, the problem somehow is still there. After browsing for a while I eventually found out that we also need to change the query translator to the older version, org.hibernate.class.ClassicQueryTranslator.
Then the application is working in the production database. Voila! It works!

My Last Day,John Stovall, Python, WLST and Jython technology...

Yesterday supposed to be my last day @work. But somehow I must come again on Monday, and reschedule my flight to Batam to Tuesday. Moving to different kind of industry, but still in the same JEE/WebLogic/Solaris/Oracle path. Just a bit apart from the telco industry.

Lately I wasn't able to update this blog because at client office, they block the blog sites. Now, after being freed now I can start updating this blog again.

After accidentally meeting with John Stovall while at Changi Airport, I got enticed to learn more and more about Python, and Jython, its Java porting. First time I met John when I came to JaMU, December 2006. I was presenting Maven 2 technology, and each of the attendees were asked to introduce themselves. You can't miss noticing that big John. We happened to be in the same airplane, and after arrived at Changi airport, I began to recover his name, I called him, "Mr. Stovall", and then he began noticing an acquaintance. He's on the way to Amsterdam, to attend a Python meeting. He began preaching the beauty of Python, the philosophy behind it: "there should be one best way to do it...". I was also realizing that the reason why Guido von Rossum moved to Google was because of almost the entire Google site is based on Python.

I told John that I was using some Jython script because it is part of the WebLogic Scripting Tool (WLST). I learned a lot on it because some of my tasks while at Ericsson's project at Cyberjaya, was to create a automatic installation, deployment and setting tools. I found out that the best way to do it is through WLST. The older method wlshell still works, but using WLST, you could have access to a broader range of futures, both offline and online (requires a running WebLogic instance).

After returning to my regular tasks at Jakarta, I began downloading latest version of Jython. Before that, I have tried one of the scripting languages that has catch up the wave and has been ported to Java: JRuby. I also tried the scripting language made specially for Java: Groovy.

I began to fall in love working with Jython. You can utilize Java classes. The scripting language is close to the functional language I've been using a lot: Gofer+, a derivation of Haskell. Prof. Wishnu Prasetya taught us Data Structure and Algorithms using that functional language. Prof Mia Indika also taught the functional programming using the Haskell language. Python, er, Jython scripting more or less resemble that of Haskell. Sorry, for most of you who learned functional programming through typing lots of Irritating Parentheses (LISP). Though I also used Scheme when learning functional programming, later I mostly used the Gofer+/Haskell family of language.

Python also supports closure, so there is no point that Ruby is better. It only has Rails that makes it famous. I know when I learn Jython in depth, this is two fold, I could create better WLST scripts for WebLogic automatic deployments and configurations, and also be able to do OOP scripting for fast prototyping. I try to construct a script to test Hibernate DAOs and Managers. I will share some of these scripts when have more time to write it.