You typically start Java applications (outside the database) by running the Java VM on a class that has a main method.
For example, the Invoice class in the file %SQLANYSAMP12%\SQLAnywhere\JavaInvoice\Invoice.java has a main method. When you execute the class from the command line using a command such as the following, it is the main method that executes.
java Invoice |
Declare the method with an array of strings as an argument:
public static void main( java.lang.String args[] ) { ... } |
Create a stored procedure that wraps this method.
CREATE PROCEDURE JavaMain( in arg char(50) ) EXTERNAL NAME 'JavaClass.main([Ljava/lang/String;)V' LANGUAGE JAVA; |
Invoke the main method using the CALL statement.
call JavaMain( 'Hello world' ); |
Due to the limitations of the SQL language, only a single string can be passed.
Discuss this page in DocCommentXchange.
|
Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1 |