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 samples-dir\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; |
For more information, see CREATE PROCEDURE statement (web services).
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. Send feedback about this page using email. |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |