ASA Programming Guide
Using Java in the Database
Configuring memory for Java
Java in the database requires memory for several purposes:
When Java is first used when a server is running, the VM is loaded into memory, requiring over 1.5 Mb of memory. This is part of the database-wide requirements. An additional VM is loaded for each database that uses Java.
For each connection that uses Java, a new instance of the VM loads for that connection. The new instance requires about 200K per connection.
Each class definition that is used in a Java application is loaded into memory. This is held in database-wide memory: separate copies are not required for individual connections.
Each connection requires a working set of Java variables and application stack space (used for method arguments and so on).
You can control memory use in the following ways:
Set the overall cache size You must use a cache size sufficient to meet all the requirements for non-relocatable memory.
The cache size is set when the server is started using the -c
option.
In many cases, a cache size of 8 Mb is sufficient.
Set the namespace size The Java namespace size is the maximum size, in bytes, of the per database memory allocation.
You can set this using the JAVA_NAMESPACE_SIZE option. The option is global, and can only be set by a user with DBA authority.
Set the heap size This JAVA_HEAP_SIZE option sets the maximum size, in bytes, of per-connection memory.
This option can be set for individual connections, but as it affects the memory available for other users it can be set only by a user with DBA authority.
In addition to setting memory parameters for Java, you can unload the VM when Java is not in use using the STOP JAVA statement. Only a user with DBA authority can execute this statement. The syntax is simply:
STOP JAVA
The VM loads whenever a Java operation is carried out. If you wish to explicitly load it in readiness for carrying out Java operations, you can do so by executing the following statement:
START JAVA