This chapter describes how to accomplish tasks using Java in the database. The first thing you need to do is compile and install Java classes in a database to make them available for use in SQL Anywhere.
The following is a brief introduction to the steps involved in creating Java methods and calling them from SQL. It describes how to compile and install a Java class into the database. It also describes how to access the class and its members and methods from SQL statements.
The tutorial assumes that you have a Java Development Kit (JDK) installed, including the Java compiler (javac) and Java VM.
Source code and batch files for this sample are provided in samples-dir\SQLAnywhere\JavaInvoice.
Creating and compiling the sample Java class
Choosing a Java VM
Install the sample Java class
Using the CLASSPATH variable
Accessing methods in the Java class
Accessing fields and methods of the Java object