Update:
I searched google a lot and came across one post which indicated that the ojdbc14 jar file that the server might be using may have a bug which may cause the above issue.
I was using
tomcat 6.0.13 which was using ojdbc14 - version 10.1.0.2. I, then ran the code on the weblogic instance and everything worked. Weblogic was using 10.2.0.2 version of the ojdbc14.
I copied over the 10.2.0.2 in my tomcat installation and everything worked. The latest ojdbc14 is at 10.2.0.4 -- I haven't tested it with the latest but if anyone else is experiencing a similar problem, you may want to check out the ojdbc14 versions before mucking around in the code.
Good Luck.