Top Description Fields Constructors Methods
org.h2.engine

public Class SysProperties

extends Object
Class Inheritance
Imports
org.h2.util.MathUtils, .Utils

The constants defined in this class are initialized from system properties. Some system properties are per machine settings, and others are as a last resort and temporary solution to work around a problem in the application or database engine. Also, there are system properties to enable features that are not yet fully tested or that are not backward compatible.

System properties can be set when starting the virtual machine:

java -Dh2.baseDir=/temp
They can be set within the application, but this must be done before loading any classes of this database (before loading the JDBC driver):
System.setProperty("h2.baseDir", "/temp");

Field Summary

Modifier and TypeField and Description
public static final String
ALLOWED_CLASSES

System property h2.allowedClasses (default: *).

public static final String
AUTH_CONFIG_FILE

System property h2.authConfigFile (default: null).

public static final String
BIND_ADDRESS

System property h2.bindAddress (default: null).

public static final boolean
CHECK

System property h2.check (default: true for JDK/JRE, false for Android).

public static final String
CLIENT_TRACE_DIRECTORY

System property h2.clientTraceDirectory (default: trace.db/).

public static final int
COLLATOR_CACHE_SIZE

System property h2.collatorCacheSize (default: 3 2000).

public static final int
CONSOLE_MAX_PROCEDURES_LIST_COLUMNS

System property h2.consoleProcedureColumns (default: 500).

public static final int
CONSOLE_MAX_TABLES_LIST_COLUMNS

System property h2.consoleTableColumns (default: 500).

public static final int
CONSOLE_MAX_TABLES_LIST_INDEXES

System property h2.consoleTableIndexes (default: 100).

public static final boolean
CONSOLE_STREAM

System property h2.consoleStream (default: true).

public static final int
CONSOLE_TIMEOUT

System property h2.consoleTimeout (default: 1800000).

public static final int
DATASOURCE_TRACE_LEVEL

System property h2.dataSourceTraceLevel (default: 1).

public static final int
DELAY_WRONG_PASSWORD_MAX

System property h2.delayWrongPasswordMax (default: 4000).

public static final int
DELAY_WRONG_PASSWORD_MIN

System property h2.delayWrongPasswordMin (default: 250).

public static boolean
FORCE_AUTOCOMMIT_OFF_ON_COMMIT

System property h2.forceAutoCommitOffOnCommit (default: false).

private static final String
public static final String
H2_BROWSER

INTERNAL

public static final String
public static final String
JAVA_OBJECT_SERIALIZER

System property h2.javaObjectSerializer (default: null).

public static final boolean
JAVA_SYSTEM_COMPILER

System property h2.javaSystemCompiler (default: true).

public static final int
LOB_CLIENT_MAX_SIZE_MEMORY

System property h2.lobClientMaxSizeMemory (default: 1048576).

public static boolean
lobCloseBetweenReads

System property h2.lobCloseBetweenReads (default: false).

public static final int
MAX_FILE_RETRY

System property h2.maxFileRetry (default: 16).

public static final int
MAX_MEMORY_ROWS

System property h2.maxMemoryRows (default: 40000 per GB of available RAM).

public static final int
MAX_RECONNECT

System property h2.maxReconnect (default: 3).

public static final long
MAX_TRACE_DATA_LENGTH

System property h2.maxTraceDataLength (default: 65535).

public static final boolean
NIO_CLEANER_HACK

System property h2.nioCleanerHack (default: false).

public static final boolean
NIO_LOAD_MAPPED

System property h2.nioLoadMapped (default: false).

public static final boolean
OBJECT_CACHE

System property h2.objectCache (default: true).

public static final int
OBJECT_CACHE_MAX_PER_ELEMENT_SIZE

System property h2.objectCacheMaxPerElementSize (default: 4096).

public static final int
OBJECT_CACHE_SIZE

System property h2.objectCacheSize (default: 1024).

public static final String
PG_DEFAULT_CLIENT_ENCODING

System property h2.pgClientEncoding (default: UTF-8).

public static final String
PREFIX_TEMP_FILE

System property h2.prefixTempFile (default: h2.temp).

public static final int
SERVER_CACHED_OBJECTS

System property h2.serverCachedObjects (default: 64).

public static final int
SERVER_RESULT_SET_FETCH_SIZE

System property h2.serverResultSetFetchSize (default: 100).

public static final int
SOCKET_CONNECT_RETRY

System property h2.socketConnectRetry (default: 16).

public static final int
SOCKET_CONNECT_TIMEOUT

System property h2.socketConnectTimeout (default: 2000).

public static final long
SPLIT_FILE_SIZE_SHIFT

System property h2.splitFileSizeShift (default: 30).

public static final boolean
THREAD_DEADLOCK_DETECTOR

System property h2.threadDeadlockDetector (default: false).

public static final boolean
TRACE_IO

System property h2.traceIO (default: false).

public static final String
URL_MAP

System property h2.urlMap (default: null).

public static final boolean
USE_THREAD_CONTEXT_CLASS_LOADER

System property h2.useThreadContextClassLoader (default: false).

public static final String
USER_HOME

System property user.home (empty string if not set).

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static int
getAutoScaledForMemoryProperty(String key, int defaultValue)

This method attempts to auto-scale some of our properties to take advantage of more powerful machines out of the box.

public static String

Returns:

base directory
getBaseDir
()

INTERNAL

public static String

Returns:

the current value
getScriptDirectory
()

System property h2.scriptDirectory (default: empty string).

public static void
setBaseDir(String
base directory
dir
)

INTERNAL

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ALLOWED_CLASSESback to summary
public static final String ALLOWED_CLASSES

System property h2.allowedClasses (default: *). Comma separated list of class names or prefixes.

AUTH_CONFIG_FILEback to summary
public static final String AUTH_CONFIG_FILE

System property h2.authConfigFile (default: null). authConfigFile define the URL of configuration file of org.h2.security.auth.DefaultAuthenticator

BIND_ADDRESSback to summary
public static final String BIND_ADDRESS

System property h2.bindAddress (default: null). The bind address to use.

CHECKback to summary
public static final boolean CHECK

System property h2.check (default: true for JDK/JRE, false for Android). Optional additional checks in the database engine.

CLIENT_TRACE_DIRECTORYback to summary
public static final String CLIENT_TRACE_DIRECTORY

System property h2.clientTraceDirectory (default: trace.db/). Directory where the trace files of the JDBC client are stored (only for client / server).

COLLATOR_CACHE_SIZEback to summary
public static final int COLLATOR_CACHE_SIZE

System property h2.collatorCacheSize (default: 3 2000). The cache size for collation keys (in elements). Used when a collator has been set for the database.

CONSOLE_MAX_PROCEDURES_LIST_COLUMNSback to summary
public static final int CONSOLE_MAX_PROCEDURES_LIST_COLUMNS

System property h2.consoleProcedureColumns (default: 500). Up to this many procedures, the column names are listed.

CONSOLE_MAX_TABLES_LIST_COLUMNSback to summary
public static final int CONSOLE_MAX_TABLES_LIST_COLUMNS

System property h2.consoleTableColumns (default: 500). Up to this many tables, the column names are listed.

CONSOLE_MAX_TABLES_LIST_INDEXESback to summary
public static final int CONSOLE_MAX_TABLES_LIST_INDEXES

System property h2.consoleTableIndexes (default: 100). Up to this many tables, the column type and indexes are listed.

CONSOLE_STREAMback to summary
public static final boolean CONSOLE_STREAM

System property h2.consoleStream (default: true). H2 Console: stream query results.

CONSOLE_TIMEOUTback to summary
public static final int CONSOLE_TIMEOUT

System property h2.consoleTimeout (default: 1800000). H2 Console: session timeout in milliseconds. The default is 30 minutes.

DATASOURCE_TRACE_LEVELback to summary
public static final int DATASOURCE_TRACE_LEVEL

System property h2.dataSourceTraceLevel (default: 1). The trace level of the data source implementation. Default is 1 for error.

DELAY_WRONG_PASSWORD_MAXback to summary
public static final int DELAY_WRONG_PASSWORD_MAX

System property h2.delayWrongPasswordMax (default: 4000). The maximum delay in milliseconds before an exception is thrown for using the wrong user name or password. This slows down brute force attacks. The delay is reset after a successful login. The value 0 means there is no maximum delay.

DELAY_WRONG_PASSWORD_MINback to summary
public static final int DELAY_WRONG_PASSWORD_MIN

System property h2.delayWrongPasswordMin (default: 250). The minimum delay in milliseconds before an exception is thrown for using the wrong user name or password. This slows down brute force attacks. The delay is reset to this value after a successful login. Unsuccessful logins will double the time until DELAY_WRONG_PASSWORD_MAX. To disable the delay, set this system property to 0.

FORCE_AUTOCOMMIT_OFF_ON_COMMITback to summary
public static boolean FORCE_AUTOCOMMIT_OFF_ON_COMMIT

System property h2.forceAutoCommitOffOnCommit (default: false). Throw error if transaction's auto-commit property is true when a commit is executed.

H2_BASE_DIRback to summary
private static final String H2_BASE_DIR
H2_BROWSERback to summary
public static final String H2_BROWSER

INTERNAL

H2_SCRIPT_DIRECTORYback to summary
public static final String H2_SCRIPT_DIRECTORY

INTERNAL

JAVA_OBJECT_SERIALIZERback to summary
public static final String JAVA_OBJECT_SERIALIZER

System property h2.javaObjectSerializer (default: null). The JavaObjectSerializer class name for java objects being stored in column of type OTHER. It must be the same on client and server to work correctly.

JAVA_SYSTEM_COMPILERback to summary
public static final boolean JAVA_SYSTEM_COMPILER

System property h2.javaSystemCompiler (default: true). Whether to use the Java system compiler (ToolProvider.getSystemJavaCompiler()) if it is available to compile user defined functions. If disabled or if the system compiler is not available, the com.sun.tools.javac compiler is used if available, and "javac" (as an external process) is used if not.

LOB_CLIENT_MAX_SIZE_MEMORYback to summary
public static final int LOB_CLIENT_MAX_SIZE_MEMORY

System property h2.lobClientMaxSizeMemory (default: 1048576). The maximum size of a LOB object to keep in memory on the client side when using the server mode.

lobCloseBetweenReadsback to summary
public static boolean lobCloseBetweenReads

System property h2.lobCloseBetweenReads (default: false). Close LOB files between read operations.

MAX_FILE_RETRYback to summary
public static final int MAX_FILE_RETRY

System property h2.maxFileRetry (default: 16). Number of times to retry file delete and rename. in Windows, files can't be deleted if they are open. Waiting a bit can help (sometimes the Windows Explorer opens the files for a short time) may help. Sometimes, running garbage collection may close files if the user forgot to call Connection.close() or InputStream.close().

MAX_MEMORY_ROWSback to summary
public static final int MAX_MEMORY_ROWS

System property h2.maxMemoryRows (default: 40000 per GB of available RAM). The default maximum number of rows to be kept in memory in a result set.

MAX_RECONNECTback to summary
public static final int MAX_RECONNECT

System property h2.maxReconnect (default: 3). The maximum number of tries to reconnect in a row.

MAX_TRACE_DATA_LENGTHback to summary
public static final long MAX_TRACE_DATA_LENGTH

System property h2.maxTraceDataLength (default: 65535). The maximum size of a LOB value that is written as data to the trace system.

NIO_CLEANER_HACKback to summary
public static final boolean NIO_CLEANER_HACK

System property h2.nioCleanerHack (default: false). If enabled, use the reflection hack to un-map the mapped file if possible. If disabled, System.gc() is called in a loop until the object is garbage collected. See also https://bugs.openjdk.java.net/browse/JDK-4724038

NIO_LOAD_MAPPEDback to summary
public static final boolean NIO_LOAD_MAPPED

System property h2.nioLoadMapped (default: false). If the mapped buffer should be loaded when the file is opened. This can improve performance.

OBJECT_CACHEback to summary
public static final boolean OBJECT_CACHE

System property h2.objectCache (default: true). Cache commonly used values (numbers, strings). There is a shared cache for all values.

OBJECT_CACHE_MAX_PER_ELEMENT_SIZEback to summary
public static final int OBJECT_CACHE_MAX_PER_ELEMENT_SIZE

System property h2.objectCacheMaxPerElementSize (default: 4096). The maximum size (precision) of an object in the cache.

OBJECT_CACHE_SIZEback to summary
public static final int OBJECT_CACHE_SIZE

System property h2.objectCacheSize (default: 1024). The maximum number of objects in the cache. This value must be a power of 2.

PG_DEFAULT_CLIENT_ENCODINGback to summary
public static final String PG_DEFAULT_CLIENT_ENCODING

System property h2.pgClientEncoding (default: UTF-8). Default client encoding for PG server. It is used if the client does not sends his encoding.

PREFIX_TEMP_FILEback to summary
public static final String PREFIX_TEMP_FILE

System property h2.prefixTempFile (default: h2.temp). The prefix for temporary files in the temp directory.

SERVER_CACHED_OBJECTSback to summary
public static final int SERVER_CACHED_OBJECTS

System property h2.serverCachedObjects (default: 64). TCP Server: number of cached objects per session.

SERVER_RESULT_SET_FETCH_SIZEback to summary
public static final int SERVER_RESULT_SET_FETCH_SIZE

System property h2.serverResultSetFetchSize (default: 100). The default result set fetch size when using the server mode.

SOCKET_CONNECT_RETRYback to summary
public static final int SOCKET_CONNECT_RETRY

System property h2.socketConnectRetry (default: 16). The number of times to retry opening a socket. Windows sometimes fails to open a socket, see bug https://bugs.openjdk.java.net/browse/JDK-6213296

SOCKET_CONNECT_TIMEOUTback to summary
public static final int SOCKET_CONNECT_TIMEOUT

System property h2.socketConnectTimeout (default: 2000). The timeout in milliseconds to connect to a server.

SPLIT_FILE_SIZE_SHIFTback to summary
public static final long SPLIT_FILE_SIZE_SHIFT

System property h2.splitFileSizeShift (default: 30). The maximum file size of a split file is 1L << x.

THREAD_DEADLOCK_DETECTORback to summary
public static final boolean THREAD_DEADLOCK_DETECTOR

System property h2.threadDeadlockDetector (default: false). Detect thread deadlocks in a background thread.

TRACE_IOback to summary
public static final boolean TRACE_IO

System property h2.traceIO (default: false). Trace all I/O operations.

URL_MAPback to summary
public static final String URL_MAP

System property h2.urlMap (default: null). A properties file that contains a mapping between database URLs. New connections are written into the file. An empty value in the map means no redirection is used for the given URL.

USE_THREAD_CONTEXT_CLASS_LOADERback to summary
public static final boolean USE_THREAD_CONTEXT_CLASS_LOADER

System property h2.useThreadContextClassLoader (default: false). Instead of using the default class loader when deserializing objects, the current thread-context class loader will be used.

USER_HOMEback to summary
public static final String USER_HOME

System property user.home (empty string if not set). It is usually set by the system, and used as a replacement for ~ in file names.

Constructor Detail

SysPropertiesback to summary
private SysProperties()

Method Detail

getAutoScaledForMemoryPropertyback to summary
private static int getAutoScaledForMemoryProperty(String key, int defaultValue)

This method attempts to auto-scale some of our properties to take advantage of more powerful machines out of the box. We assume that our default properties are set correctly for approx. 1G of memory, and scale them up if we have more.

getBaseDirback to summary
public static String getBaseDir()

INTERNAL

Returns:String

base directory

getScriptDirectoryback to summary
public static String getScriptDirectory()

System property h2.scriptDirectory (default: empty string). Relative or absolute directory where the script files are stored to or read from.

Returns:String

the current value

setBaseDirback to summary
public static void setBaseDir(String dir)

INTERNAL

Parameters
dir:String

base directory