public class Sample {
public static int add( int a, int b ){
return a + b;
}
}
public class Sample {
public static int add( int a, int b ){
return new java.lang.Integer(a + b);
}
}
Execute the SQL statement to deploy the Java class to the database.
INSTALL JAVA NEW FROM FILE 'd:\\java\\samples\\Sample.class'
Create the SQL function that maps to the Java method “Sample.add( int,
int)”.
CREATE FUNCTION sample_add_int (IN a int, IN b int)
RETURNS int
EXTERNAL NAME 'Sample.add(II)I'
LANGUAGE JAVA
Use the SQL function in a SELECT statement.
SELECT sample_add_int( ID, ID ) from Customers WHERE ID < 110
Remove a Java class from the database.
REMOVE JAVA CLASS ‘Sample’
Update a java class in the database.
INSTALL JAVA UPDATE FROM FILE 'd:\\java\\samples\\Sample.class'
INSTALL JAVA JAR UPDATE FROM FILE 'd:\\java\\samples\\Sample.jar'