The database server must be set up to locate a Java VM. Since you can specify different Java VMs for each database, the ALTER EXTERNAL ENVIRONMENT statement can be used to indicate the location (path) of the Java VM.
ALTER EXTERNAL ENVIRONMENT JAVA LOCATION 'c:\\jdk1.5.0_06\\jre\\bin\\java.exe';
If the location is not set, the database server searches for the location of the Java VM, as follows:
JAVA_HOME and JAVAHOME are environment variables commonly created when installing a Java VM. If neither of these exist, you can create them manually, and point them to the root directory of your Java VM. However, this is not required if you use the ALTER EXTERNAL ENVIRONMENT statement.
To specify the location of the Java VM (Interactive SQL)
Start Interactive SQL and connect to the database.
In the SQL Statements pane, type the following statement:
ALTER EXTERNAL ENVIRONMENT JAVA LOCATION 'path\\java.exe';
Here, path indicates the location of the Java VM (for example, c:\\jdk1.5.0_06\\jre\\bin).
You can also use the ALTER EXTERNAL ENVIRONMENT to specify the database user whose connection can be used for installing classes and performing other Java-related administrative tasks.
ALTER EXTERNAL ENVIRONMENT JAVA USER user_name
For more information, see ALTER EXTERNAL ENVIRONMENT statement.
Use the java_vm_options option to specify any additional command line options that are required to start the Java VM.
SET OPTION PUBLIC.java_vm_options='java-options';
For more information, see java_vm_options option [database].
If you want to use JAVA in the database, but do not have a Java Runtime Environment (JRE) installed, you can install and use any Java JRE that you want to. Once installed, it is best to set the JAVA_HOME or JAVAHOME environment variable to point to the root of the installed JRE. Note that most Java installers set one of these environment variables by default. Once a JRE is installed and JAVA_HOME or JAVAHOME is set correctly, you should then be able to use Java in the database without performing any additional steps.
|Send feedback about this page via email or DocCommentXchange||Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0|