Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Push the limits of Java UDRs in Informix Dynamic Server V10

Extend IDS features with Java

Halit (Hal) M. Maner (hmaner@msystemsintl.com), Chief Technology Officer, M Systems International, Inc.
Halit (Hal) Maner is the President and Chief Technology Officer of M Systems International, Inc., a solutions developer based in the Research Triangle Park in North Carolina, USA. M Systems specializes in database application development and support, database administration, and network administration in the Windows, Unix, and Linux platforms. Hal is certified in Informix, DB2, and Microsoft SQL Server databases. He has a Bachelor's of Science in Automatic Control and Computer Engineering as well as an MBA, plus 22 years of experience as a programmer, DBA, software architect, and team leader.
Jean Georges Perrin has been involved in software engineering for the last decade, using many development languages ranging from Informix-4GL to Java, through Visual Basic, C, C++ and PHP. Jean Georges has been working on the Web and related technologies since 1994. He has been elected to the Board of Directors of IIUG since 2002. He headed various R&D and project lead positions and lives near Strasbourg, France, with his wife and two sons.

Summary:  Learn how to write server side Java™ code in the form of a User Defined Routine (UDR), running inside the Informix® Dynamic Server (IDS). Also, learn how to set up your project using modern tools such as Eclipse.

Date:  05 Oct 2006
Level:  Intermediate PDF:  A4 and Letter (1938 KB | 48 pages)Get Adobe® Reader®

Activity:  6369 views
Comments:  

Appendix

Creating a Smart Blob Space (sbspace)

You have been advised do the following steps under the informix user.

When running:

onspaces -c -S sbspace1 -p C:\IFMXDATA\ol_scoobidoo\sbspace1_dat.000
  -o 0 -s 10000

The result should be:

Verifying physical disk space, please wait ...
Space successfully added.

** WARNING **  A level 0 archive of Root DBSpace will need to be done.

If you get:

The file C:\IFMXDATA\ol_scoobidoo\sbspace1_dat.000 does not exist.

Create the file first, by calling:

copy con C:\IFMXDATA\ol_scoobidoo\sbspace1_dat.000

Press Ctrl+Z (or F6) then Enter to exit. The file is created and you can call the onspaces utility again.


Install the Super Stores database

You are advised do the following steps under the informix user.

This example relies on the Super Store database, which is not installed by default on the system.

First you need to create an empty file that will contain the Smart Blob Space.

copy con C:\IFMXDATA\ol_scoobidoo\s9_sbspc_dat.000

Press Ctrl+Z (or F6) then Enter to exit. You then need to run onspaces to create the Smart Blob Space.

onspaces -c -S s9_sbspc -g 2 -p C:\IFMXDATA\ol_scoobidoo\s9_sbspc_dat.000
  -o 0 -s 2000

Finally, you can install it:

dbaccessdemo_ud –log–dbspace dbs_scoobidoo superstores_demo  


Restart the Informix engine from the command line.

It is sometimes easier to do things through the command line rather than through clicking. Here is a way to restart your IDS instance without using the mouse.

To stop the engine, type:

net stop "Informix IDS - ol_scoobidoo"  

You should get:

The Informix IDS - ol_scoobidoo service is stopping....
The Informix IDS - ol_scoobidoo service was stopped successfully.

To start the engine, type:

net start "Informix IDS - ol_scoobidoo"  

You should get:

The Informix IDS - ol_scoobidoo service is starting.
The Informix IDS - ol_scoobidoo service was started successfully.


Listing the Virtual Processors

To be sure that your JVP is running, you can use the onstat command.

onstat -g glo

This is a typical result when the JVP is not running.

IBM Informix Dynamic Server Version 10.00.TC4
-- On-Line -- Up 1 days 04:57:56 -- 21568 Kbytes

MT global info:
sessions threads  vps      lngspins
0        14       8        11

          sched calls     thread switches yield 0   yield n   yield forever
total:    6343727         650771          5692983   208988    167929
per sec:  0               0               0         0         0

Virtual processor summary:
 class       vps       usercpu   syscpu    total
 cpu         1         2.92      1.00      3.92
 aio         1         0.00      0.00      0.00
 lio         1         0.00      0.00      0.00
 pio         1         0.00      0.00      0.00
 adm         1         0.25      0.20      0.45
 soc         2         0.00      0.00      0.00
 msc         1         0.00      0.07      0.07
 total       8         3.17      1.27      4.43

Individual virtual processors:
 vp    pid       class       usercpu   syscpu    total
 1     2472      cpu         2.92      1.00      3.92
 2     3576      adm         0.25      0.20      0.45
 3     3580      lio         0.00      0.00      0.00
 4     3680      pio         0.00      0.00      0.00
 5     3716      aio         0.00      0.00      0.00
 6     3720      msc         0.00      0.07      0.07
 7     3724      soc         0.00      0.00      0.00
 8     3728      soc         0.00      0.00      0.00
                 tot         3.17      1.27      4.43

This is a typical result when the JVP is running.

IBM Informix Dynamic Server Version 10.00.TC4     
-- On-Line -- Up 00:01:27 -- 21568 Kbytes

MT global info:
sessions threads  vps      lngspins
0        14       9        0

          sched calls     thread switches yield 0   yield n   yield forever
total:    4829332         210947          4618410   129       105396
per sec:  0               0               0         0         0

Virtual processor summary:
 class       vps       usercpu   syscpu    total
 cpu         1         2.18      0.72      2.90
 aio         1         0.00      0.00      0.00
 lio         1         0.00      0.00      0.00
 pio         1         0.00      0.00      0.00
 adm         1         0.00      0.00      0.00
 soc         2         0.00      0.00      0.00
 msc         1         0.00      0.00      0.00
 jvp         1         0.00      0.00      0.00
 total       9         2.18      0.72      2.90

Individual virtual processors:
 vp    pid       class       usercpu   syscpu    total
 1     2888      cpu         2.18      0.72      2.90
 2     2260      adm         0.00      0.00      0.00
 3     6052      jvp         0.00      0.00      0.00
 4     3784      lio         0.00      0.00      0.00
 5     2316      pio         0.00      0.00      0.00
 6     5452      aio         0.00      0.00      0.00
 7     4876      msc         0.00      0.00      0.00
 8     2928      soc         0.00      0.00      0.00
 9     3644      soc         0.00      0.00      0.00
                 tot         2.18      0.72      2.90


Add your JDK in the path

If you want to use the JDK on the command line, you should ensure that javac (the Java compiler) is in your system path.

To check that it is available, start a command prompt and type javac. If you get the following error message, continue reading.

'javac' is not recognized as an internal or external command, 
operable program or batch file.

Locate javac on your system. Typically it is in C:\Program Files\Java\jdk1.5.0_05\bin. The minor version might defer on your system.

Click Start > Control Panel. Double-click on the System icon. Click on the Advanced tab, and then click Environment Variables. In the system variables block, find and select the Path entry. Click Edit.

Before typing anything, ensure that your cursor is at the end of the field. Press either the right arrow key or the End key on your keyboard.

Type:

;C:\Program Files\Java\jdk1.5.0_05\bin

Do not forget the semicolon.

Click OK three times.

To check that it works, open a new command prompt and type javac, you should get its usage.


Troubleshooting – Error #25785 (Informix error)

If you get:

25785: Cannot create external routine (gethelloworld) without the EXTEND role.   

It means that you cannot create an external function or a procedure without the privileges of the EXTEND role. You can either grant the role to the user or log in as the Informix user. DB-Access lets you connect as a specific user: Connection, Connect, Select your database server (here ol_scoobidoo), enter informix as the username and then your password, and you can select the database.


Troubleshooting – Error #46002 (SQL State)

If you get:

 (46002) - Attempt to remove or alter path for non-existing jar: 
 (superstores_demo.informix.hw_jar).

Symptom: You are probably trying to update a JAR, which does not exist (like launching the update script before the install script or just after the uninstall script).

Solution: Install the JAR first.

If you get:

 (46002) - Attempt to install an existing jar: (superstores_demo.informix.pc_jar).  

Symptom: You are probably running the install script but the JAR is already installed.

Solution: Uninstall the JAR first or use the update script.


Troubleshooting – Error #46003 (SQL State)

If you get:

 (46003) - Invalid jar removal. All dependent UDRs not dropped.  

You will have a hard time finding where the error is documented. It is a SQL State error: “46003 Java DDL - Invalid class deletion”.

I originally made a typo when I installed the Hello World function and called it “getHellowWorld” (notice the two ‘w’s). The function was installed OK (with the typo), was running OK (with the typo) but uninstallation did not work as I was dropping the function without the typo, and IDS did not want to remove the JAR file, and thus the error #46003.

We used AGS’ ServerStudio and it listed all the functions available to me and we discovered the wrongly-spelled function in the database.


Troubleshooting – Function not found

Another common problem is that the function is not found by the engine, simply because the user does not have the rights to run it. Think about granting the right to your users.

GRANT EXECUTE ON FUNCTION getHelloWorld() TO ALL;


Problems when installing the source code

You may encounter some problem when installing the source code on your system, as illustrated in Figure 25.


Figure 25. Problem during integration of the project
Problem during integration of the project

The error Unbound classpath variable: 'INFORMIXKRAKATOADIR/jdbc.jar' in project net.jgp.lab.udr.pricechanger, simply means that your INFORMIXKRAKATOADIR variable is not defined within your workspace. To solve the problem, refer to an earlier section of the tutorial where the INFORMIXKRAKATOADIR variable was set.

9 of 11 | Previous | Next

Comments



Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Information Management, Java technology
ArticleID=165519
TutorialTitle=Push the limits of Java UDRs in Informix Dynamic Server V10
publish-date=10052006
author1-email=hmaner@msystemsintl.com
author1-email-cc=
author2-email=jgp@jgp.net
author2-email-cc=jgp@iiug.org

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Try IBM PureSystems. No charge.