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.6.0_20\\jre\\bin\\java.exe';
If the location is not set, the database server searches for the location of the Java VM, as follows:
Check the JAVA_HOME environment variable.
Check the JAVAHOME environment variable.
Check the path.
If the VM cannot be located, return an error.
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.
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.6.0_20\\jre\\bin).
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';
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.
Discuter à propos de cette page dans DocCommentXchange.
|Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1|