Professional Documents
Culture Documents
Calling Custom Java Classes and JAR Files in ODI Via Jython or Java BeanShell
Calling Custom Java Classes and JAR Files in ODI Via Jython or Java BeanShell
Posted: June 9th, 2010 | Author: Uli Bethke | Filed under: Oracle Data Integrator (ODI) | Tags: jar, java, java class, odi | 2 Comments
First we create a simple Java class that creates and writes to a text file and save it as FileWrite.java view source print?
01 import java.io.*; 02 03 public class FileWrite 04 { 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 } } } } catch (IOException e) { e.printStackTrace(); File file= new File("C:\\MyFile.txt"); fos = new FileOutputStream(file); dos=new DataOutputStream(fos); dos.writeInt(2333); dos.writeChars("Hello World"); try { public void writeFile() { FileOutputStream fos; DataOutputStream dos;
Next we create a .jar file from the class view source print?
1 c:\jar cf FileWrite.jar FileWrite.class
We then copy and paste the .jar archive to the ODI drivers folder Next we restart the ODI agent. We can now call methods in this class from either Jython view source print?
1 import FileWrite 2 3 fw=FileWrite() 4 fw.writeFile()
If you want to master scripting in ODI get the following books. Java BeanShell Scripting in Java: Languages, Frameworks, and Patterns Jython The Definitive Guide to Jython: Python for the Java Platform. Jython Essentials (OReilly Scripting)
Hi, I have written java program which i want to run though ODI.My questions are as follows: 1. At which place i need to put my code and jar files i.e. do i need to put my code on the machine where ODI is installed?
You need to place the JAR file at ODI's driver folder.