External stored procedures and Java

Java is one of the programming languages that the SQL for i supports as the languages for external stored procedures. And power of Java needs no introduction.

I am not going to say that using the Java as external language is super easy as using the RPG/RPGLE as the external language. But its not complicated either.

Basically in the EXTERNAL NAME clause we need to give a qualified Java method name in place of RPGLE program/module. When we call the stored procedure, SQL executes the given Java method.

When using Java, we need to understand few points:

  1. Java is an objected oriented language. But we can not initialize an object with SQL.
    1. So, only option is to call STATIC method.
  2. In RPG/RPGLE parameters are passed by the reference. But In Java parameters are passed by value.
    1. More later.

 

To link Java method with SQL. we can use either

  1. a java class file
  2. – OR –
  3. a jar file

 

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *