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:
- Java is an objected oriented language. But we can not initialize an object with SQL.
- So, only option is to call STATIC method.
- In RPG/RPGLE parameters are passed by the reference. But In Java parameters are passed by value.
- More later.
To link Java method with SQL. we can use either
- a java class file
- – OR –
- a jar file