org.h2.constant
Class SysProperties

java.lang.Object
  extended by org.h2.constant.SysProperties

public class SysProperties
extends java.lang.Object

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
static boolean ALLOW_BIG_DECIMAL_EXTENSIONS
          System property h2.allowBigDecimalExtensions (default: false).
When enabled, classes that extend BigDecimal are supported in PreparedStatement.setBigDecimal.
static java.lang.String ALLOWED_CLASSES
          System property h2.allowedClasses (default: *).
Comma separated list of class names or prefixes.
static java.lang.String BIND_ADDRESS
          System property h2.bindAddress (default: null).
Comma separated list of class names or prefixes.
static java.lang.String BROWSER
          System property h2.browser (default: null).
The preferred browser to use.
static boolean CHECK
          System property h2.check (default: true).
Assertions in the database engine.
static boolean CHECK2
          System property h2.check2 (default: true).
Additional assertions in the database engine.
static java.lang.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).
static int COLLATOR_CACHE_SIZE
          System property h2.collatorCacheSize (default: 32000).
The cache size for collation keys (in elements).
static boolean CONSOLE_STREAM
          System property h2.consoleStream (default: true).
H2 Console: stream query results.
static int DATASOURCE_TRACE_LEVEL
          System property h2.dataSourceTraceLevel (default: 1).
The trace level of the data source implementation.
static 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.
static 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.
static boolean EMPTY_PASSWORD
          System property h2.emptyPassword (default: true).
Don't use a secure hash if the user name and password are empty or not set.
static boolean ENABLE_ANONYMOUS_SSL
          System property h2.enableAnonymousSSL (default: true).
When using SSL connection, the anonymous cipher suite SSL_DH_anon_WITH_RC4_128_MD5 should be enabled.
static java.lang.String FILE_ENCODING
          System property file.encoding (default: Cp1252).
It is usually set by the system and is the default encoding used for the RunScript and CSV tool.
static java.lang.String FILE_SEPARATOR
          System property file.separator (default: /).
It is usually set by the system, and used to build absolute file names.
static java.lang.String H2_SCRIPT_DIRECTORY
          INTERNAL
static java.lang.String JAVA_SPECIFICATION_VERSION
          System property java.specification.version.
It is set by the system.
static java.lang.String LINE_SEPARATOR
          System property line.separator (default: \n).
It is usually set by the system, and used by the script and trace tools.
static int LOB_CLIENT_MAX_SIZE_MEMORY
          System property h2.lobClientMaxSizeMemory (default: 65536).
The maximum size of a LOB object to keep in memory on the client side when using the server mode.
static int LOB_FILES_PER_DIRECTORY
          System property h2.lobFilesPerDirectory (default: 256).
Maximum number of LOB files per directory.
static boolean LOB_IN_DATABASE
          System property h2.lobInDatabase (default: false).
Store LOB files in the database.
static boolean lobCloseBetweenReads
          System property h2.lobCloseBetweenReads (default: false).
Close LOB files between read operations.
static boolean LOG_ALL_ERRORS
          System property h2.logAllErrors (default: false).
Write stack traces of any kind of error to a file.
static java.lang.String LOG_ALL_ERRORS_FILE
          System property h2.logAllErrorsFile (default: h2errors.txt).
File name to log errors.
static int MAX_FILE_RETRY
          System property h2.maxFileRetry (default: 16).
Number of times to retry file delete and rename.
static int MAX_RECONNECT
          System property h2.maxReconnect (default: 3).
The maximum number of tries to reconnect in a row.
static 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.
static int MIN_COLUMN_NAME_MAP
          System property h2.minColumnNameMap (default: 3).
The minimum number of columns where a hash table is created when result set methods with column name (instead of column index) parameter are called.
static boolean NIO_CLEANER_HACK
          System property h2.nioCleanerHack (default: false).
If enabled, use the reflection hack to un-map the mapped file if possible.
static boolean NIO_LOAD_MAPPED
          System property h2.nioLoadMapped (default: false).
If the mapped buffer should be loaded when the file is opened.
static boolean OBJECT_CACHE
          System property h2.objectCache (default: true).
Cache commonly used values (numbers, strings).
static int OBJECT_CACHE_MAX_PER_ELEMENT_SIZE
          System property h2.objectCacheMaxPerElementSize (default: 4096).
The maximum size (precision) of an object in the cache.
static int OBJECT_CACHE_SIZE
          System property h2.objectCacheSize (default: 1024).
The maximum number of objects in the cache.
static java.lang.String PG_DEFAULT_CLIENT_ENCODING
          System property h2.pgClientEncoding (default: UTF-8).
Default client encoding for PG server.
static java.lang.String PREFIX_TEMP_FILE
          System property h2.prefixTempFile (default: h2.temp).
The prefix for temporary files in the temp directory.
static boolean RETURN_LOB_OBJECTS
          System property h2.returnLobObjects (default: true).
When true, ResultSet.getObject for CLOB or BLOB will return a java.sql.Clob / java.sql.Blob object.
static boolean runFinalize
          System property h2.runFinalize (default: true).
Run finalizers to detect unclosed connections.
static int SERVER_CACHED_OBJECTS
          System property h2.serverCachedObjects (default: 64).
TCP Server: number of cached objects per session.
static int SERVER_RESULT_SET_FETCH_SIZE
          System property h2.serverResultSetFetchSize (default: 100).
The default result set fetch size when using the server mode.
static int SOCKET_CONNECT_RETRY
          System property h2.socketConnectRetry (default: 16).
The number of times to retry opening a socket.
static int SOCKET_CONNECT_TIMEOUT
          System property h2.socketConnectTimeout (default: 2000).
The timeout in milliseconds to connect to a server.
static boolean 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.
static long SPLIT_FILE_SIZE_SHIFT
          System property h2.splitFileSizeShift (default: 30).
The maximum file size of a split file is 1L << x.
static java.lang.String SYNC_METHOD
          System property h2.syncMethod (default: sync).
What method to call when closing the database, on checkpoint, and on CHECKPOINT SYNC.
static boolean TRACE_IO
          System property h2.traceIO (default: false).
Trace all I/O operations.
static java.lang.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.
static int WEB_MAX_VALUE_LENGTH
          System property h2.webMaxValueLength (default: 100000).
The H2 Console will abbreviate (truncate) result values larger than this size.
 
Method Summary
static java.lang.String getBaseDir()
          INTERNAL
static int getIntSetting(java.lang.String name, int defaultValue)
          INTERNAL
static java.lang.String getScriptDirectory()
          System property h2.scriptDirectory (default: empty string).
Relative or absolute directory where the script files are stored to or read from.
static java.lang.String getStringSetting(java.lang.String name, java.lang.String defaultValue)
          INTERNAL
static void setBaseDir(java.lang.String dir)
          INTERNAL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

H2_SCRIPT_DIRECTORY

public static final java.lang.String H2_SCRIPT_DIRECTORY
INTERNAL

See Also:
Constant Field Values

FILE_ENCODING

public static final java.lang.String FILE_ENCODING
System property file.encoding (default: Cp1252).
It is usually set by the system and is the default encoding used for the RunScript and CSV tool.


FILE_SEPARATOR

public static final java.lang.String FILE_SEPARATOR
System property file.separator (default: /).
It is usually set by the system, and used to build absolute file names.


JAVA_SPECIFICATION_VERSION

public static final java.lang.String JAVA_SPECIFICATION_VERSION
System property java.specification.version.
It is set by the system. Examples: 1.4, 1.5, 1.6.


LINE_SEPARATOR

public static final java.lang.String LINE_SEPARATOR
System property line.separator (default: \n).
It is usually set by the system, and used by the script and trace tools.


USER_HOME

public static final java.lang.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.


ALLOW_BIG_DECIMAL_EXTENSIONS

public static final boolean ALLOW_BIG_DECIMAL_EXTENSIONS
System property h2.allowBigDecimalExtensions (default: false).
When enabled, classes that extend BigDecimal are supported in PreparedStatement.setBigDecimal.


ALLOWED_CLASSES

public static final java.lang.String ALLOWED_CLASSES
System property h2.allowedClasses (default: *).
Comma separated list of class names or prefixes.


BROWSER

public static final java.lang.String BROWSER
System property h2.browser (default: null).
The preferred browser to use. If not set, the default browser is used. For Windows, to use the Internet Explorer, set this property to 'explorer'. For Mac OS, if the default browser is not Safari and you want to use Safari, use: java -Dh2.browser="open,-a,Safari,%url" ....


ENABLE_ANONYMOUS_SSL

public static final boolean ENABLE_ANONYMOUS_SSL
System property h2.enableAnonymousSSL (default: true).
When using SSL connection, the anonymous cipher suite SSL_DH_anon_WITH_RC4_128_MD5 should be enabled.


BIND_ADDRESS

public static final java.lang.String BIND_ADDRESS
System property h2.bindAddress (default: null).
Comma separated list of class names or prefixes.


CHECK

public static final boolean CHECK
System property h2.check (default: true).
Assertions in the database engine.


CHECK2

public static final boolean CHECK2
System property h2.check2 (default: true).
Additional assertions in the database engine.


CLIENT_TRACE_DIRECTORY

public static final java.lang.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_SIZE

public static final int 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_STREAM

public static final boolean CONSOLE_STREAM
System property h2.consoleStream (default: true).
H2 Console: stream query results.


DATASOURCE_TRACE_LEVEL

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_MIN

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.


DELAY_WRONG_PASSWORD_MAX

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.


EMPTY_PASSWORD

public static final boolean EMPTY_PASSWORD
System property h2.emptyPassword (default: true).
Don't use a secure hash if the user name and password are empty or not set.


lobCloseBetweenReads

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


LOB_FILES_PER_DIRECTORY

public static final int LOB_FILES_PER_DIRECTORY
System property h2.lobFilesPerDirectory (default: 256).
Maximum number of LOB files per directory.


LOB_IN_DATABASE

public static final boolean LOB_IN_DATABASE
System property h2.lobInDatabase (default: false).
Store LOB files in the database.


LOB_CLIENT_MAX_SIZE_MEMORY

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


LOG_ALL_ERRORS

public static final boolean LOG_ALL_ERRORS
System property h2.logAllErrors (default: false).
Write stack traces of any kind of error to a file.


LOG_ALL_ERRORS_FILE

public static final java.lang.String LOG_ALL_ERRORS_FILE
System property h2.logAllErrorsFile (default: h2errors.txt).
File name to log errors.


MAX_FILE_RETRY

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_RECONNECT

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_LENGTH

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.


MIN_COLUMN_NAME_MAP

public static final int MIN_COLUMN_NAME_MAP
System property h2.minColumnNameMap (default: 3).
The minimum number of columns where a hash table is created when result set methods with column name (instead of column index) parameter are called.


NIO_LOAD_MAPPED

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.


NIO_CLEANER_HACK

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 http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4724038


OBJECT_CACHE

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_SIZE

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_SIZE

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_ENCODING

public static final java.lang.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_FILE

public static final java.lang.String PREFIX_TEMP_FILE
System property h2.prefixTempFile (default: h2.temp).
The prefix for temporary files in the temp directory.


RETURN_LOB_OBJECTS

public static final boolean RETURN_LOB_OBJECTS
System property h2.returnLobObjects (default: true).
When true, ResultSet.getObject for CLOB or BLOB will return a java.sql.Clob / java.sql.Blob object. When set to false, it will return a java.io.Reader / java.io.InputStream.


runFinalize

public static boolean runFinalize
System property h2.runFinalize (default: true).
Run finalizers to detect unclosed connections.


SERVER_CACHED_OBJECTS

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_SIZE

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_RETRY

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 http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6213296


SOCKET_CONNECT_TIMEOUT

public static final int SOCKET_CONNECT_TIMEOUT
System property h2.socketConnectTimeout (default: 2000).
The timeout in milliseconds to connect to a server.


SORT_NULLS_HIGH

public static final boolean 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.


SPLIT_FILE_SIZE_SHIFT

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.


SYNC_METHOD

public static final java.lang.String 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).


TRACE_IO

public static final boolean TRACE_IO
System property h2.traceIO (default: false).
Trace all I/O operations.


WEB_MAX_VALUE_LENGTH

public static final int WEB_MAX_VALUE_LENGTH
System property h2.webMaxValueLength (default: 100000).
The H2 Console will abbreviate (truncate) result values larger than this size. The data in the database is not truncated, it is only to avoid out of memory in the H2 Console application.

Method Detail

getStringSetting

public static java.lang.String getStringSetting(java.lang.String name,
                                                java.lang.String defaultValue)
INTERNAL


getIntSetting

public static int getIntSetting(java.lang.String name,
                                int defaultValue)
INTERNAL


setBaseDir

public static void setBaseDir(java.lang.String dir)
INTERNAL


getBaseDir

public static java.lang.String getBaseDir()
INTERNAL


getScriptDirectory

public static java.lang.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