The database server must be set up to locate a Java Virtual Machine (VM). Since you can specify a different Java VM for each database, the ALTER EXTERNAL ENVIRONMENT statement can be used to indicate the location (path) of the Java VM.
Prérequis
Complete the steps in Lesson 1 before attempting Lesson 2.
This lesson assumes that you have the roles and privileges listed in the Privileges section at the start of this tutorial: Tutorial: Using Java in the database.
Contexte et remarques
If you do not have a Java Runtime Environment (JRE) installed, you can install and use any Java JRE as long as it is version 1.6 or later. Most Java installers set up one of the JAVA_HOME or JAVAHOME environment variables. If neither of these environment variables exist, you can create one manually, and point it to the root directory of your Java VM. However, this configuration is not required if you use the ALTER EXTERNAL ENVIRONMENT statement.
Use Interactive SQL to start the personal database server and connect to the sample database.
dbisql -c "DSN=SQL Anywhere 16 Demo" |
This step is optional. Execute a statement like the following.
ALTER EXTERNAL ENVIRONMENT JAVA LOCATION 'c:\\jdk1.7.0\\jre\\bin\\java.exe'; |
If the location of the Java VM is not specified using the LOCATION clause of the ALTER EXTERNAL ENVIRONMENT JAVA statement or the location specified is incorrect, 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 system PATH.
If the VM cannot be located, return an error.
This step is optional. Use the java_vm_options database option to specify any additional command-line options that are required to start the Java VM.
SET OPTION PUBLIC.java_vm_options='java-options'; |
Use the START JAVA statement to start the Java VM.
START JAVA; |
This statement attempts to preload the Java VM. If the database server is not able to locate and start the Java VM, then an error message is issued. This statement is optional since the database server automatically loads the Java VM when it is required.
![]() |
Discuter à propos de cette page dans DocCommentXchange.
|
Copyright © 2013, SAP AG ou société affiliée SAP - SAP Sybase SQL Anywhere 16.0 |