Installing Oracle10g JAccelerator (NCOMP) on Solaris 10 (SPARC)
Let’s suppose you find the need to natively compile some Java code on an Oracle10g database, then you would need to have JAccelerator (NCOMP) installed. I have prepared a few installations steps to follow that worked for me. It took me a few days to work this out…
Disclaimer: These steps were tested on Solaris 10 SPARC platform, with a Oracle10g 10.2.0.4 standalone database. Best efforts were made to ensure the steps are correct, but please take extra care when executing them on your platform. Do not run this on your Production environment if you are unsure what it will do.
Let’s start from the beginning…
1. To find out whether you have NCOMP installed, there are two things you can do:
select dbms_java.full_ncomp_enabled from dual * ERROR at line 1: ORA-29558: JAccelerator (NCOMP) not installed. Refer to Install Guide for instructions. ORA-06512: at "SYS.DBMS_JAVA", line 236
or try executing this on command line, which should show two lines if NCOMP is installed.
$ORACLE_HOME/OPatch/opatch lsinventory -detail |grep JAccelerator JAccelerator (COMPANION) 10.2.0.1.0 JAccelerator (COMPANION) Patch 10.2.0.4.0
2. Suppose NCOMP is not installed, then you would need to get the Oracle10g Companion CD (downloadable here). Run the installer, and select the “Oracle Database 10g Products” option which will install into your existing Oracle home. Full installation guide is available here. This will install JAccelerator 10.2.0.1.0 along with other 10g Companion products. If you run the opatch command again, you should now see JAccelerator listed.
3. Next, we need to patch JAccelerator to the latest patchset – 10.2.0.4. Download the 10.2.0.4 patchset from Metalink and start the installer as usual. Metalink Note 293658.1 explains that the OUI will see the new components installed and only install the 10.2 patches associated to the new products. Re-run catupgrd.sql and utlrp.sql .
4. After completing the patchset installation, re-running the first two checks should show you some good news.
SQL> select dbms_java.full_ncomp_enabled from dual; FULL_NCOMP_ENABLED ---------------------------------------------------- OK
$ORACLE_HOME/OPatch/opatch lsinventory -detail |grep JAccelerator JAccelerator (COMPANION) 10.2.0.1.0 JAccelerator (COMPANION) Patch 10.2.0.4.0
5. Before one can natively compile anything, we need to follow a few more steps as documented here. Verify a C compiler and linker is installed, and the ncomp properties file knows their full path. Suppose your platform is like mine, then it means you probably need a proper C compiler:
$ which cc /usr/ucb/cc $ cc /usr/ucb/cc: language optional software package not installed
6. Metalink Note: 43208.1 documents a list of Certified Compilers. For Solaris SPARC:
* 10.1.0 Sun ONE Studio 8, C/C++ 5.5 * 10.2.0 Sun ONE Studio 8, C/C++ 5.5 * 11.1.0 Sun ONE Studio 11, C/C++ 5.8 Note: Sun ONE Studio 8 or higher is supported with 9.2, 10.1, 10.2
In any case, I downloaded Sun Studio 11 software here. This software installation requires root privilege and installs the C compiler into /opt/SUNWspro by default. Check all system requirements before installation. As an aside, I also tried gcc 3.4.6 but NCOMP didn’t like it very much…
7. After the Sun Studio software is installed, update the PATH and LD_LIBRARY_PATH environment variables, e.g.
export PATH=/opt/SUNWspro/bin:$PATH export LD_LIBRARY_PATH=/opt/SUNWspro/lib:$LD_LIBRARY_PATH
8. Inside the $ORACLE_HOME/javavm/jahome directory, you will possibly find two properties files.
$ grep 'CC =' Settings*.properties Settings.properties:CC = cc Settings_os.properties:CC = /opt/SunProd/SUNWspro8/bin/cc
Update these two lines to the C compiler location, such that if I do another grep:
Settings.properties:CC = /opt/SUNWspro/bin/cc Settings_os.properties:CC = /opt/SUNWspro/bin/cc
9. We are just about done… to enable the database user to perform native compilation, the user needs to be granted certain privileges as documented here, where /app/oracle/10/db is my $ORACLE_HOME:
grant java_deploy to fredt;
grant javasyspriv to fredt;
call dbms_java.grant_permission('FREDT', 'java.io.FilePermission', '/app/oracle/10/db/-', 'read,write');
10. We can now ncomp away!
ncomp -u fredt/fredt@MODDB <myJar.jar>

Hello!
Very Interesting post! Thank you for such interesting resource!
PS: Sorry for my bad english, I’v just started to learn this language
See you!
Your, Raiul Baztepo
RaiulBaztepo
March 28, 2009 at 9:43 pm
Brilliant post.
Must appreciate your clear and precise explanation. Oracle Metalink needs people with your kind of expertise and explaining style. I have struggling with this bloody NCOMP thing for hours now and stumbled upon your website. Everything worked. Thanks to you!
Fire Exit
August 17, 2009 at 3:28 pm
Thanks for your kind words.
Glad it helped.
rgds,
fred
fredericktang
August 18, 2009 at 12:32 am