# SysProperties 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");
Methods
static String | getScriptDirectory() System property `h2.scriptDirectory` (default: empty string). Relative or absolute directory where the script files are stored to or read from.
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: the current value
Fields
static String | ALLOWED_CLASSES
static String | AUTH_CONFIG_FILE
static boolean | BIG_DECIMAL_IS_DECIMAL
static String | BIND_ADDRESS
static boolean | CHECK
static String | CLIENT_TRACE_DIRECTORY
static int | COLLATOR_CACHE_SIZE
static int | CONSOLE_MAX_PROCEDURES_LIST_COLUMNS
static int | CONSOLE_MAX_TABLES_LIST_COLUMNS
static int | CONSOLE_MAX_TABLES_LIST_INDEXES
static boolean | CONSOLE_STREAM
static int | CONSOLE_TIMEOUT
static String | CUSTOM_DATA_TYPES_HANDLER
static int | DATASOURCE_TRACE_LEVEL
static int | DELAY_WRONG_PASSWORD_MAX
static int | DELAY_WRONG_PASSWORD_MIN
static boolean | ENABLE_ANONYMOUS_TLS
static String | FILE_SEPARATOR
static boolean | IMPLICIT_RELATIVE_PATH
static String | JAVA_OBJECT_SERIALIZER
static boolean | JAVA_SYSTEM_COMPILER
static String | LINE_SEPARATOR
static int | LOB_CLIENT_MAX_SIZE_MEMORY
static int | LOB_FILES_PER_DIRECTORY
static int | MAX_FILE_RETRY
static int | MAX_MEMORY_ROWS
static int | MAX_RECONNECT
static long | MAX_TRACE_DATA_LENGTH
static boolean | MODIFY_ON_WRITE
static boolean | NIO_CLEANER_HACK
static boolean | NIO_LOAD_MAPPED
static boolean | OBJECT_CACHE
static int | OBJECT_CACHE_MAX_PER_ELEMENT_SIZE
static int | OBJECT_CACHE_SIZE
static boolean | OLD_RESULT_SET_GET_OBJECT
static String | PG_DEFAULT_CLIENT_ENCODING
static String | PREFIX_TEMP_FILE
static boolean | PREVIEW
static boolean | RETURN_OFFSET_DATE_TIME
static int | SERVER_CACHED_OBJECTS
static int | SERVER_RESULT_SET_FETCH_SIZE
static int | SOCKET_CONNECT_RETRY
static int | SOCKET_CONNECT_TIMEOUT
static boolean | SORT_BINARY_UNSIGNED
static boolean | SORT_NULLS_HIGH
static boolean | SORT_UUID_UNSIGNED
static long | SPLIT_FILE_SIZE_SHIFT
static String | SYNC_METHOD
static boolean | THREAD_DEADLOCK_DETECTOR
static boolean | TRACE_IO
static String | URL_MAP
static String | USER_HOME
static boolean | USE_THREAD_CONTEXT_CLASS_LOADER
static boolean | lobCloseBetweenReads
static boolean | serializeJavaObject
#### ALLOWED_CLASSES System property `h2.allowedClasses` (default: *). Comma separated list of class names or prefixes. #### AUTH_CONFIG_FILE System property `h2.authConfigFile` (default: null). authConfigFile define the URL of configuration file of {@link org.h2.security.auth.DefaultAuthenticator} #### BIG_DECIMAL_IS_DECIMAL System property {@code h2.bigDecimalIsDecimal}, {@code true} by default unless {@code h2.preview} is enabled. If {@code true} map {@code BigDecimal} to {@code DECIMAL} type. If {@code false} map {@code BigDecimal} to {@code NUMERIC} as specified in JDBC specification (see Mapping from Java Object Types to JDBC Types). #### BIND_ADDRESS System property `h2.bindAddress` (default: null). The bind address to use. #### CHECK System property `h2.check` (default: true for JDK/JRE, false for Android). Optional additional checks in the database engine. #### 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_SIZE System property `h2.collatorCacheSize` (default: 32000). The cache size for collation keys (in elements). Used when a collator has been set for the database. #### 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_COLUMNS System property `h2.consoleTableColumns` (default: 500). Up to this many tables, the column names are listed. #### CONSOLE_MAX_TABLES_LIST_INDEXES System property `h2.consoleTableIndexes` (default: 100). Up to this many tables, the column type and indexes are listed. #### CONSOLE_STREAM System property `h2.consoleStream` (default: true). H2 Console: stream query results. #### CONSOLE_TIMEOUT System property `h2.consoleTimeout` (default: 1800000). H2 Console: session timeout in milliseconds. The default is 30 minutes. #### CUSTOM_DATA_TYPES_HANDLER System property `h2.customDataTypesHandler` (default: null). The CustomDataTypesHandler class name that is used to provide support for user defined custom data types. It must be the same on client and server to work correctly. #### 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_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_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. #### ENABLE_ANONYMOUS_TLS System property `h2.enableAnonymousTLS` (default: true). When using TLS connection, the anonymous cipher suites should be enabled. #### FILE_SEPARATOR System property `file.separator`. It is set by the system, and used to build absolute file names. #### IMPLICIT_RELATIVE_PATH System property `h2.implicitRelativePath` (default: false). If disabled, relative paths in database URLs need to be written as jdbc:h2:./test instead of jdbc:h2:test. #### 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_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. #### LINE_SEPARATOR System property `line.separator`. It is set by the system, and used by the script and trace tools. #### 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. #### LOB_FILES_PER_DIRECTORY System property `h2.lobFilesPerDirectory` (default: 256). Maximum number of LOB files per directory. #### 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_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_RECONNECT System property `h2.maxReconnect` (default: 3). The maximum number of tries to reconnect in a row. #### 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. #### MODIFY_ON_WRITE System property `h2.modifyOnWrite` (default: false). Only modify the database file when recovery is necessary, or when writing to the database. If disabled, opening the database always writes to the file (except if the database is read-only). When enabled, the serialized file lock is faster. #### 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 http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4724038 #### 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_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_SIZE System property `h2.objectCacheMaxPerElementSize` (default: 4096). The maximum size (precision) of an object in the cache. #### 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. #### OLD_RESULT_SET_GET_OBJECT System property {@code h2.oldResultSetGetObject}, {@code true} by default unless {@code h2.preview} is enabled. If {@code true} return {@code Byte} and {@code Short} from {@code ResultSet#getObject(int)} and {@code ResultSet#getObject(String)} for {@code TINYINT} and {@code SMALLINT} values. If {@code false} return {@code Integer} for them as specified in JDBC specification (see Mapping from JDBC Types to Java Object Types). #### 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_FILE System property `h2.prefixTempFile` (default: h2.temp). The prefix for temporary files in the temp directory. #### PREVIEW System property {@code h2.preview} (default: false). Controls default values of other properties. If {@code true} default values of other properties are changed to planned defaults for the 1.5.x versions of H2. Some other functionality may be also enabled or disabled. #### RETURN_OFFSET_DATE_TIME System property {@code h2.returnOffsetDateTime}, {@code false} by default unless {@code h2.preview} is enabled. If {@code true} {@link java.sql.ResultSet#getObject(int)} and {@link java.sql.ResultSet#getObject(String)} return {@code TIMESTAMP WITH TIME ZONE} values as {@code java.time.OffsetDateTime}. If {@code false} return them as {@code org.h2.api.TimestampWithTimeZone} instead. This property has effect only on Java 8 / Android API 26 and later versions. Without JSR-310 {@code org.h2.api.TimestampWithTimeZone} is used unconditionally. #### SERVER_CACHED_OBJECTS System property `h2.serverCachedObjects` (default: 64). TCP Server: number of cached objects per session. #### SERVER_RESULT_SET_FETCH_SIZE System property `h2.serverResultSetFetchSize` (default: 100). The default result set fetch size when using the server mode. #### 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 http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6213296 #### SOCKET_CONNECT_TIMEOUT System property `h2.socketConnectTimeout` (default: 2000). The timeout in milliseconds to connect to a server. #### SORT_BINARY_UNSIGNED System property `h2.sortBinaryUnsigned` (default: true). Whether binary data should be sorted in unsigned mode (0xff is larger than 0x00) by default in new databases. #### SORT_NULLS_HIGH System property `h2.sortNullsHigh` (default: false). Invert the default sorting behavior for NULL, such that NULL is at the end of a result set in an ascending sort and at the beginning of a result set in a descending sort. #### SORT_UUID_UNSIGNED System property {@code h2.sortUuidUnsigned}, {@code false} by default unless {@code h2.preview} is enabled. Whether UUID data should be sorted in unsigned mode ('ffffffff-ffff-ffff-ffff-ffffffffffff' is larger than '00000000-0000-0000-0000-000000000000') by default in new databases. #### SPLIT_FILE_SIZE_SHIFT System property `h2.splitFileSizeShift` (default: 30). The maximum file size of a split file is 1L << x. #### SYNC_METHOD System property `h2.syncMethod` (default: sync). What method to call when closing the database, on checkpoint, and on CHECKPOINT SYNC. The following options are supported: "sync" (default): RandomAccessFile.getFD().sync(); "force": RandomAccessFile.getChannel().force(true); "forceFalse": RandomAccessFile.getChannel().force(false); "": do not call a method (fast but there is a risk of data loss on power failure). #### THREAD_DEADLOCK_DETECTOR System property `h2.threadDeadlockDetector` (default: false). Detect thread deadlocks in a background thread. #### TRACE_IO System property `h2.traceIO` (default: false). Trace all I/O operations. #### 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. #### 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. #### 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. #### lobCloseBetweenReads System property `h2.lobCloseBetweenReads` (default: false). Close LOB files between read operations. #### serializeJavaObject System property `h2.serializeJavaObject` (default: true). If true, values of type OTHER will be stored in serialized form and have the semantics of binary data for all operations (such as sorting and conversion to string). If false, the objects will be serialized only for I/O operations and a few other special cases (for example when someone tries to get the value in binary form or when comparing objects that are not comparable otherwise). If the object implements the Comparable interface, the method compareTo will be used for sorting (but only if objects being compared have a common comparable super type). Otherwise the objects will be compared by type, and if they are the same by hashCode, and if the hash codes are equal, but objects are not, the serialized forms (the byte arrays) are compared. The string representation of the values use the toString method of object. In client-server mode, the server must have all required classes in the class path. On the client side, this setting is required to be disabled as well, to have correct string representation and display size. In embedded mode, no data copying occurs, so the user has to make defensive copy himself before storing, or ensure that the value object is immutable.