zoukankan      html  css  js  c++  java
  • HSQLDB Properties

    Chapter 12. Properties

    Fred Toussi

    The HSQL Development Group

    $Revision: 5199 $

    Copyright 2002-2012 Fred Toussi. Permission is granted to distribute this document without any alteration under the terms of the HSQLDB license. Additional permission is granted to the HSQL Development Group to distribute this document with or without alterations under the terms of the HSQLDB license.

    2013-03-18 19:59:45+0000

    Connection URL

    The normal method of accessing a HyperSQL catalog is via the JDBC Connection interface. An introduction to different methods of providing database services and accessing them can be found in the SQL Language chapter. Details and examples of how to connect via JDBC are provided in our JavaDoc for JDBCConnection.

    A uniform method is used to distinguish between different types of connection. The common driver identifier is jdbc:hsqldb: followed by a protocol identifier (mem: file: res: hsql: http: hsqls: https:) then followed by host and port identifiers in the case of servers, then followed by database identifier. Additional property / value pairs can be appended to the end of the URL, separated with semicolons.

    Table 12.1. Memory Database URL

    Driver and ProtocolHost and Port ExampleDatabase Example
    jdbc:hsqldb:mem:
    not available
    accounts

    Lowercase, single-word identifier creates the in-memory database when the first connection is made. Subsequent use of the same Connection URL connects to the existing DB.

    The old form for the URL, jdbc:hsqldb:. creates or connects to the same database as the new form for the URL, jdbc:hsqldb:mem:.


    Table 12.2. File Database URL

    Driver and ProtocolHost and Port ExampleDatabase Example
    jdbc:hsqldb:file:
    not available
    accounts
    /opt/db/accounts
    C:/data/mydb

    The file path specifies the database files. It should consist of a relative or absolute path to the directory containing the database files, followed by a '/' and the database name. In the above examples the first one refers to a set of mydb.* files in the directory where the javacommand for running the application was issued. The second and third examples refer to absolute paths on the host machine: For example, files named accounts.* in the directory /opt/db for the accounts database.


    Table 12.3. Resource Database URL

    Driver and ProtocolHost and Port ExampleDatabase Example
    jdbc:hsqldb:res:
    not available
    /adirectory/dbname
    Database files can be loaded from one of the jars specified as part of the Java command the same way as resource files are accessed in Java programs. The /adirectory above stands for a directory in one of the jars.

    Table 12.4. Server Database URL

    Driver and ProtocolHost and Port ExampleDatabase Example
    jdbc:hsqldb:hsql:
    jdbc:hsqldb:hsqls:
    jdbc:hsqldb:http:
    jdbc:hsqldb:https:
    //localhost
    //192.0.0.10:9500
    //dbserver.somedomain.com
    /an_alias
    /enrolments
    /quickdb

    The host and port specify the IP address or host name of the server and an optional port number. The database to connect to is specified by an alias. This alias is a lowercase string defined in the server.properties file to refer to an actual database on the file system of the server or a transient, in-memory database on the server. The following example lines in server.properties or webserver.properties define the database aliases listed above and accessible to clients to refer to different file and in-memory databases.

    The old form for the server URL, e.g., jdbc:hsqldb:hsql//localhost connects to the same database as the new form for the URL, jdbc:hsqldb:hsql//localhost/ where the alias is a zero length string.

    Variables In Connection URL

    Two types of variables are allowed for mem: and file: database URLs.

    If the database part of a file: database begins with ~/ or ~\ the tilde character is replaced with the value of the system property "user.home" resulting in the database being created or accessed in this directory, or one of its subdirectories. In the example below, the database files for mydb are located in the user's home directory.

        jdbc:hsqldb:file:~/mydb;shutdown=true

    If the database URL contains a string in the form of ${propname} then the sequence of characters is replaced with the system property with the given name. For example you can use this in the URL of a database that is used in a web application and define the system property, "propname" in the web application properties. In the example below, the string ${mydbpath} is replaced with the value of the property, mydbpath

        jdbc:hsqldb:file:${mydbpath};sql.enforce_types=true

    Connection properties

    Each JDBC Connection to a database can specify connection properties. The properties user and password are always required. The following optional properties can also be used.

    Connection properties are specified either by establishing the connection via the method call below, or the property can be appended to the full Connection URL.

        DriverManager.getConnection (String url, Properties info);

    Table 12.5. User and Password

    NameDefaultDescription
    user SA user name

    Standard property. This property is case sensitive. Example below:

        jdbc:hsqldb:file:enrolments;user=aUserName;ifexists=true
    password empty string password for the user

    Standard property. This property is case sensitive. Example below:

        jdbc:hsqldb:file:enrolments;user=aUserName;password=3xLVz

    For compatibility with other engines, a non-standard form of specifying user and password is also supported. In this form, user name and password appear at the end of the URL string, prefixed respectively with the question mark and the ampersand:

        jdbc:hsqldb:file:enrolments;create=false?user=aUserName&password=3xLVz

    Table 12.6. Column Names in JDBC ResultSet

    NameDefaultDescription
    get_column_name true column name in ResultSet

    This property is used for compatibility with other JDBC driver implementations. When true (the default), ResultSet.getColumnName(int c) returns the underlying column name. This property can be specified differently for different connections to the same database.

    The default is true. When the property is false, the above method returns the same value as ResultSet.getColumnLabel(int column) Example below:

        jdbc:hsqldb:hsql://localhost/enrolments;get_column_name=false

    When a ResultSet is used inside a user-defined stored procedure, the default, true, is always used for this property.


    Table 12.7. Creating New Database

    NameDefaultDescription
    ifexists false connect only if database already exists

    Has an effect only with mem: and file: database. When true, will not create a new database if one does not already exist for the URL.

    When the property is false (the default), a new mem: or file: database will be created if it does not exist.

    Setting the property to true is useful when troubleshooting as no database is created if the URL is malformed. Example below:

        jdbc:hsqldb:file:enrolments;ifexists=true
    create true create the database if it does not exist

    Similar to the ifexists property, but with opposite meaning.

    Has an effect only with mem: and file: database. When false, will not create a new database if one does not already exist for the URL.

    When the property is true (the default), a new mem: or file: database will be created if it does not exist.

    Setting the property to true is useful when troubleshooting as no database is created if the URL is malformed. Example below:

        jdbc:hsqldb:file:enrolments;create=false

    Table 12.8. Automatic Shutdown

    NameDefaultDescription
    shutdown false shut down the database when the last connection is closed

    If this property is true, when the last connection to a database is closed, the database is automatically shut down. The property takes effect only when the first connection is made to the database. This means the connection that opens the database. It has no effect if used with subsequent connections.

    This command has two uses. One is for test suites, where connections to the database are made from one JVM context, immediately followed by another context. The other use is for applications where it is not easy to configure the environment to shutdown the database. Examples reported by users include web application servers, where the closing of the last connection coincides with the web app being shut down.

        jdbc:hsqldb:file:enrolments;shutdown=true

    In addition, when the first connection to an in-process file: or mem: database creates a new database all the user-defined database properties can be specified as URL properties. See the next section for details.

    Database Properties in Connection URL and Properties

    The database engine has several properties that are listed in the System Management chapter. These properties can be changed via SQL commands after a connection is made to the database. It is possible to specify most of these properties in the connection properties or as part of the URL string when the first connection is made to a new file: or mem: database. This allows the properties to be set without using any SQL commands. The corresponding SQL command is given for each property.

    If the properties are used for connection to an existing database, they are ignored.

    The exceptions are the following property settings that are allowed for the first connection to an existing database: readonly=truefiles_readonly=truehsqldb.lock_file=falsehsqldb.sqllog=1-3. These specific property / value pairs override the existing database properties. For example a normal database is opened as readonly, or the lock file is not created, or the sqllog level is set to a value between 1 and 3.

    Management of properties has changed since version 1.8. The old SET PROPERTY statement does not change a property and is ignored. The statement is retained to simplify application upgrades.

    In the example URL below, two properties are set for the first connection to a new database.

        jdbc:hsqldb:file:enrolments;hsqldb.cache_rows=10000;hsqldb.nio_data_file=false

    In the table below, database properties that can be used as part of the URL or in connection properties are listed. For each property that can also be set with an SQL statement, the statement is also given. These statements are described more extensively in the System Management chapter.

    Table 12.9. Validity Check Property

    NameDefaultDescription
    check_props false checks the validity of the connection properties

    If the property is true, every database property that is specified on the URL or in connection properties is checked and if it is not used correctly, an error is returned.

    this property cannot be set with an SQL statement

    SQL Conformance Properties

    Table 12.10. SQL Keyword Use as Identifier

    NameDefaultDescription
    sql.enforce_names false enforcing SQL keywords

    This property, when set true, prevents SQL keywords being used for database object names such as columns and tables.

    SET DATABASE SQL NAMES { TRUE | FALSE }

    Table 12.11. SQL Keyword Starting with the Underscore or Containing Dollar Characters

    NameDefaultDescription
    sql.regular_names true enforcing SQL keywords

    This property, when set true, prevents database object names such as columns and tables beginning with the underscore or containing the dollar character.

    SET DATABASE SQL REGULAR NAMES { TRUE | FALSE }

    Table 12.12. Reference to Columns Names

    NameDefaultDescription
    sql.enforce_refs false enforcing column reference disambiguation

    This property, when set true, causes an error when an SQL statement (usually a select statement) contains column references that can be resolved by more than one table name or alias. In effect forces such column references to have a table name or table alias qualifier.

    SET DATABASE SQL REFERENCES { TRUE | FALSE }

    Table 12.13. String Size Declaration

    NameDefaultDescription
    sql.enforce_size true size enforcement of string columns

    Conforms to SQL standards for size and precision of data types. When true, all VARCHAR column type declarations require a size. When the property is false and there is no size in the declaration, a default size is used. Note that all other types accept a declaration without a size, which is interpreted as a default size.

    SET DATABASE SQL SIZE { TRUE | FALSE }

    Table 12.14. Type Enforcement in Comparison and Assignment

    NameDefaultDescription
    sql.enforce_types false enforcing type compatibility

    This property, when set true, causes an error when an SQL statements contains comparisons or assignments that are non-standard due to type mismatch. Most illegal comparisons and assignments will cause an exception regardless of this setting. This setting applies to a small number of comparisons and assignments that are possible, but not standard conformant, and were allowed in previous versions of HSQLDB.

    SET DATABASE SQL TYPES { TRUE | FALSE }

    Table 12.15. Foreign Key Triggered Data Change

    NameDefaultDescription
    sql.enforce_tdc_delete true enforcing triggered data change violation for deletes

    The ON DELETE and ON UPDATE clauses of constraints cause data changes in rows in different tables or the same table. When there are multiple constraints, a row may be updated by one constraint and deleted by another constraint in the same operation. This is not allowed by default. Changing this property to false allows such violations of the Standard to pass without an exception. Used for porting from database engines that do not enforce the constraints.

    SET DATABASE SQL TDC DELETE { TRUE | FALSE }
     
    sql.enforce_tdc_update true enforcing triggered data change violation for updates

    The ON DELETE and ON UPDATE clauses of foreign key constraints cause data changes in rows in different tables or the same table. With multiple constraint, a field may be updated by two constraints and set to different values. This is not allowed by default. Changing this property to false allows such violations of the Standard to pass without an exception. Used for porting from database engines that do not enforce the constraints properly.

    SET DATABASE SQL TDC UPDATE { TRUE | FALSE }

    Table 12.16. Use of LOB for LONGVAR Types

    NameDefaultDescription
    sql.longvar_is_lob false translating longvarchar and longvarbinary to lob

    This property, when set true, causes type declarations using LONGVARCHAR and LONGVARBINARY to be translated to CLOB and BLOB respectively. By default, they are translated to VARCHAR and VARBINARY.

    SET DATABASE SQL LONGVAR IS LOB { TRUE | FALSE }

    Table 12.17. Concatenation with NULL

    NameDefaultDescription
    sql.concat_nulls true behaviour of concatenation involving one null

    This property, when set false, causes the concatenation of a null and a not null value to return the not null value. By default, it returns null.

    SET DATABASE SQL CONCAT NULLS { TRUE | FALSE }

    Table 12.18. NULL in Multi-Column UNIQUE Constraints

    NameDefaultDescription
    sql.unique_nulls true behaviour of multi-column UNIQUE constraints with null values

    This property, when set false, causes multi-column unique constrains to be more restrictive for value sets that contain a mix of null and not null values.

    SET DATABASE SQL UNIQUE NULLS { TRUE | FALSE }

    Table 12.19. Truncation or Rounding in Type Conversion

    NameDefaultDescription
    sql.convert_trunc true behaviour of type conversion from DOUBLE to integral types

    This property, when set false, causes type conversions from DOUBLE to any integral type to use rounding. By default truncation is used.

    SET DATABASE SQL CONVERT TRUNCATE { TRUE | FALSE }

    Table 12.20. Decimal Scale of Division and AVG Values

    NameDefaultDescription
    sql.avg_scale 0 decimal scale of values returned by division and the AVG and MEDIAN aggregate functions

    By default, the result of a division or an AVG or MEDIAN aggregate has the same type and scale as the aggregated value. For INTEGER types, the scale is 0. When this property is set to a value other than the default 0, then the scale is used if it is greater than the scale of the divisor or aggregated value. This property does not affect DOUBLE values. Values between 0 - 10 can be used for this property.

    SET DATABASE SQL AVG SCALE <numeric value>

    Table 12.21. Support for NaN values

    NameDefaultDescription
    sql.double_nan true behaviour of expressions returning DOUBLE NaN

    This property, when set false, causes division of DOUBLE values by Zero to return a Double.NaN value. By default an exception is thrown.

    SET DATABASE SQL DOUBLE NAN { TRUE | FALSE }

    Table 12.22. Sort order of NULL values

    NameDefaultDescription
    sql.nulls_first true ordering of NULL values

    By default, nulls appear before not-null values when a result set is ordered without specifying NULLS FIRST or NULLS LAST. This property, when set false, causes nulls to appear by default after not-null values in result sets with ORDER BY

    SET DATABASE SQL NULLS FIRST { TRUE | FALSE }

    Table 12.23. Sort order of NULL values with DESC

    NameDefaultDescription
    sql.nulls_order true ordering of NULL values when DESC is used

    By default, when an ORDER BY clause that does not specify NULLS FIRST or NULLS LAST is used, nulls are ordered according to the sql.nulls_first setting even when DESC is used after ORDER BY. This property, when set false, causes nulls to appear in the opposite position when DESC is used.

    SET DATABASE SQL NULLS ORDER { TRUE | FALSE }

    Table 12.24. String comparison with padding

    NameDefaultDescription
    sql.pad_space true ordering of strings with trailing spaces

    By default, when two strings are compared, he shorter string is padded with spaces before comparison. When this property is set false, no padding takes place before comparison. Without padding, the shorter string is never equal to the longer one.

    Before version 2.0, HSQLDB used NO PAD comparison. If you need the old behaviour, use this property when opening an older database.

    SET DEFAULT COLLATION <collation name> [ NO PAD | PAD SPACE ]

    Table 12.25. Case Insensitive Varchar columns

    NameDefaultDescription
    sql.ignore_case false case-insensitive VARCHAR

    When this propery is set true, all VARCHAR declarations in CREATE TABLE and other statemenst are replaced with VARCHAR_IGNORECASE. This is designed for compatibility with some databases that use case-insensitive comparison. It is better to use VARCHAR_INGNORECASE selectively for specific columns that require it.

    SET DATABASE SQL IGNORECASE { TRUE | FALSE }

    Table 12.26. DB2 Style Syntax

    NameDefaultDescription
    sql.syntax_db2 false support for DB2 style syntax

    This property, when set true, allows compatibility with some aspects of this dialect.

    SET DATABASE SQL SYNTAX DB2 { TRUE | FALSE }

    Table 12.27. MSSQL Style Syntax

    NameDefaultDescription
    sql.syntax_mss false support for MS SQL Server style syntax

    This property, when set true, switches the arguments of the CONVERT function and also allow compatibility with some other aspects of this dialect.

    SET DATABASE SQL SYNTAX MSS { TRUE | FALSE }

    Table 12.28. MySQL Style Syntax

    NameDefaultDescription
    sql.syntax_mys false support for MySQL style syntax

    This property, when set true, enables support for TEXT and AUTO_INCREMENT types and also allow compatibility with some other aspects of this dialect.

    SET DATABASE SQL SYNTAX MYS { TRUE | FALSE }

    Table 12.29. Oracle Style Syntax

    NameDefaultDescription
    sql.syntax_ora false support for Oracle style syntax

    This property, when set true, enables support for non-standard types. It also enables DUAL, ROWNUM, NEXTVAL and CURRVAL syntax and and also allow compatibility with some other aspects of this dialect.

    SET DATABASE SQL SYNTAX ORA { TRUE | FALSE }

    Table 12.30. PostgreSQL Style Syntax

    NameDefaultDescription
    sql.syntax_pgs false support for PostgreSQL style syntax

    This property, when set true, enables support for TEXT and SERIAL types. It also enables NEXTVAL, CURRVAL and LASTVAL syntax and also allow compatibility with some other aspects of this dialect.

    SET DATABASE SQL SYNTAX PGS { TRUE | FALSE }

    Database Operations Properties

    Table 12.31. Default Table Type

    NameDefaultDescription
    hsqldb.default_table_type memory type of table created with unqualified CREATE TABLE

    The CREATE TABLE command results in a MEMORY table by default. Setting the value cached for this property will result in a cached table by default. The qualified forms such as CREATE MEMORY TABLE or CREATE CACHED TABLE are not affected at all by this property.

    SET DATABASE DEFAULT TABLE TYPE { CACHED | MEMORY }

    Table 12.32. Transaction Control Mode

    NameDefaultDescription
    hsqldb.tx locks database transaction control mode

    Indicates the transaction control mode for the database. The values, locks, mvlocks and mvcc are allowed.

    SET DATABASE TRANSACTION CONTROL { LOCKS | MVLOCKS | MVCC }

    Table 12.33. Default Isolation Level for Sessions

    NameDefaultDescription
    hsqldb.tx_level read_commited database default transaction isolation level

    Indicates the default transaction isolation level for each new session. The values, read_committed and serializable are allowed. Individual sessions can change their isolation level.

    SET DATABASE DEFAULT ISOLATION LEVEL { READ COMMITTED | SERIALIZABLE }

    Table 12.34. Transaction Rollback in Deadlock

    NameDefaultDescription
    hsqldb.tx_conflict_rollback true effect of deadlock or other conflicts on transaction

    When a transaction deadlock or other unresolvable conflict is about to happen, the current transaction is rolled back and an exception is raised. When this property is set false, the transaction is not rolled back. Only the latest action that would cause the conflict is undone and an error is returned. The property should not be changed unless the application can quickly perform an alternative statement and complete the transaction. It is provided for compatibility with other database engines which do not roll back the transaction upon deadlock.

    SET DATABASE TRANSACTION ROLLBACK ON CONFLICT { TRUE | FALSE }

    Table 12.35. Time Zone and Interval Types

    NameDefaultDescription
    hsqldb.translate_tti_types true usage of type codes for advanced datetime and interval types

    If the property is true, the TIME / TIMESTAMP WITH TIME ZONE types and INTERVAL types are represented in JDBC methods of ResultSetMetaData and DatabaseMetaData as JDBC datetime types without time zone and the VARCHAR type respectively. The original type names are preserved.

    SET DATABASE SQL TRANSLATE TTI TYPES { TRUE | FALSE }

    Database File and Memory Properties

    Table 12.36. Opening Database as Read Only

    NameDefaultDescription
    readonly false readonly database - is used to open an existing file: database

    This property is a special property that can be added manually to the .properties file, or included in the URL or connection properties. When this property is true, the database becomes readonly. This can be used with an existing database to open it for readonly operation.

    this property cannot be set with an SQL statement - it can be used in the .properties file

    Table 12.37. Opening Database Without Modifying the Files

    NameDefaultDescription
    files_readonly false readonly files database - is used to open an existing file: database

    This property is used similarly to the hsqldb.readonly property. When this property is true, CACHED and TEXT tables are readonly but memory tables are not. Any change to the data is not persisted to database files.

    this property cannot be set with an SQL statement - it can be used in the .properties file

    Table 12.38. Huge database files and tables

    NameDefaultDescription
    hsqldb.large_data false enable huge database files

    By default, up to 2 billion rows can be stored in disk-based CACHED tables. Setting this property to true increases the limit to 256 billion rows. This property is used as a connection property.

    this property cannot be set with an SQL statement - it can be used as a connection property for the connection that opens the database

    Table 12.39. Temporary Result Rows in Memory

    NameDefaultDescription
    hsqldb.result_max_memory_rows 0 storage of temporary results and tables in memory or on disk

    This property can be set to specify how many rows of each results or temporary table are stored in memory before the table is written to disk. The default is zero and means data is always stored in memory. If this setting is used, it should be set above 1000.

    SET DATABASE DEFAULT RESULT MEMORY ROWS <numeric value>

    Table 12.40. Event Logging

    NameDefaultDescription
    hsqldb.applog 0 application logging level

    The default level 0 indicates no logging. Level 1 results in minimal logging, including any failures. Level 2 indicates all events, including ordinary events. LEVEL 3 adds details of some of the normal operations. The events are logged in a file ending with ".app.log".

    SET DATABASE EVENT LOG LEVEL { 0 | 1 | 2 | 3}

    Table 12.41. SQL Logging

    NameDefaultDescription
    hsqldb.sqllog 0 sql logging level - can also be used to open an existing file: database

    The default level 0 indicates no logging. Level 1 logs only commits and rollbacks. Level 2 logs all the SQL statements executed, together with their parameter values. Long statements and parameter values are truncated. Level 3 is similar to Level 2 but does not truncate long statements and values. The events are logged in a file ending with ".sql.log". This property applies to existing file: databases as well as new databases.

    SET DATABASE EVENT LOG SQL LEVEL { 0 | 1 | 2 | 3}

    Table 12.42. Rows Cached In Memory

    NameDefaultDescription
    hsqldb.cache_free_count 512 maximum number of unused space recovery

    The default indicates 512 unused spaces are kept for later use. The value can range between 0 - 8096.

    When rows are deleted, the space is recovered and kept for reuse for new rows. If too many rows are deleted, the smaller recovered spaces are lost and the largest ones are retained for later use. Normally there is no need to set this property.

    this property cannot be set with an SQL statement

    Table 12.43. Rows Cached In Memory

    NameDefaultDescription
    hsqldb.cache_rows 50000 maximum number of rows in memory cache

    Indicates the maximum number of rows of cached tables that are held in memory.

    The value can range between 100- 4 billion. If the value is set via SET FILES then it becomes effective after the next database SHUTDOWN or CHECKPOINT.

    SET FILES CACHE ROWS <numeric value>

    Table 12.44. Size of Rows Cached in Memory

    NameDefaultDescription
    hsqldb.cache_size 10000 memory cache size

    Indicates the total size (in kilobytes) of rows in the memory cache used with cached tables. This size is calculated as the binary size of the rows, for example an INTEGER is 4 bytes. The actual memory size used by the objects is 2 to 4 times this value. This depends on the types of objects in database rows, for example with binary objects the factor is less than 2, with character strings, the factor is just over 2 and with date and timestamp objects the factor is over 3.

    The value can range between 100 KB - 4 GB. The default is 10,000, representing 10,000 kilobytes. If the value is set via SET FILES then it becomes effective after the next database SHUTDOWN or CHECKPOINT.

    SET FILES CACHE SIZE <numeric value>

    Table 12.45. Size Scale of Disk Table Storage

    NameDefaultDescription
    hsqldb.cache_file_scale 32 unit used for storage of rows in the .data file

    The default value corresponds to a maximum size of 64 GB for the .data file. This can be increased to 64, 128, 256, 512, or 1024 resulting in up to 2 TB GB storage. Settings below 32 in older databases are preserved until a SHUTDOWN COMPACT.

    SET FILES SCALE <numeric value>

    Table 12.46. Size Scale of LOB Storage

    NameDefaultDescription
    hsqldb.lob_file_scale 32 unit used for storage of lobs in the .lobs file

    The default value represents units of 32KB. When the average size of individual lobs in the database is smaller, a smaller unit can be used to reduce the overall size of the .lobs file. Values 1, 2, 4, 8, 16, 32 can be used.

    SET FILES LOB SCALE <numeric value>

    Table 12.47. Compression of CLOB data

    NameDefaultDescription
    hsqldb.lob_compressed false use of compression for storage of clobs

    The default value is false, indicating no compression. When the value is true at the time of creation of a new database, clobs are stored as compressed parts.

    SET FILES LOB COMPRESSED { TRUE | FALSE }

    Table 12.48. Internal Backup of Database Files

    NameDefaultDescription
    hsqldb.inc_backup true incremental backup of data file

    During updates, the contents of the .data file are modified. When this property is true, the modified contents are backed up gradually. This causes a marginal slowdown in operations, but allows fast checkpoint and shutdown.

    When the property is false, the .data file is backed up entirely at the time of checkpoint and shutdown. Up to version 1.8, HSQLDB supported only full backup.

    SET FILES BACKUP INCREMENT { TRUE | FALSE }

    Table 12.49. Use of Lock File

    NameDefaultDescription
    hsqldb.lock_file true use of lock file - can also be used with an existing database

    By default, a lock file is created for each file database that is opened for read and write. This property can be specified with the value false to prevent the lock file from being created. This usage is not recommended but may be desirable when flash type storage is used. This property applies to existing file: databases as well as new databases.

    this property cannot be set with an SQL statement

    Table 12.50. Logging Data Change Statements

    NameDefaultDescription
    hsqldb.log_data true logging data change

    This property can be set to false when database recovery in the event of an unexpected crash is not necessary. A database that is used as a temporary cache is an example. Regardless of the value of this property, if there is a proper shutdown of the database, all the changed data is stored. A checkpoint or shutdown still rewrites the .script file and saves the .backup file according to the other settings.

    SET FILES LOG  { TRUE | FALSE }

    Table 12.51. Automatic Checkpoint Frequency

    NameDefaultDescription
    hsqldb.log_size 50 size of log when checkpoint is performed

    The value is the size (in megabytes) that the .log file can reach before an automatic checkpoint occurs. A checkpoint rewrites the .script file and clears the .log file.

    SET FILES LOG SIZE <numeric value>

    Table 12.52. Automatic Defrag at Checkpoint

    NameDefaultDescription
    hsqldb.defrag_limit 0 percentage of unused space causing a defrag at checkpoint

    When a checkpoint is performed, the percentage of wasted space in the .data file is calculated. If the wasted space is above the specified limit, a defrag operation is performed. The default is 0, which means no automatic checkpoint. The numeric value must be between 0 and 100 and is interpreted as a percentage of the current size of the .data file.

    SET FILES DEFRAG <numeric value>

    Table 12.53. Compression of the .script file

    NameDefaultDescription
    hsqldb.script_format 0 compressed .script file

    If the property is set with the value 3, the .script file is stored in compressed format. This is useful for large script files. The .script is no longer readable when the hsqldb.script_format=3 has been used.

    This property cannot be set with an SQL statement

    Table 12.54. Logging Data Change Statements Frequency

    NameDefaultDescription
    hsqldb.write_delay true write delay performing fsync of log file entries

    If the property is true, the default WRITE DELAY property of the database is used, which is 500 milliseconds. If the property is false, the WRITE DELAY is set to 0 seconds. The log is written to file regardless of this property. The property controls the fsync that forces the written log to be persisted to disk. The SQL command for this property allows more precise control over the property.

    SET FILES WRITE DELAY {{ TRUE | FALSE } | <seconds value> | <milliseconds value> MILLIS

    Table 12.55. Logging Data Change Statements Frequency

    NameDefaultDescription
    hsqldb.write_delay_millis 500 write delay for performing fsync of log file entries

    If the property is used, the WRITE DELAY property of the database is set the given value in milliseconds. The property controls the fsync that forces the written log to be persisted to disk. The SQL command for this property allows the same level of control over the property.

    SET FILES WRITE DELAY {{ TRUE | FALSE } | <seconds value> | <milliseconds value> MILLIS

    Table 12.56. Use of NIO for Disk Table Storage

    NameDefaultDescription
    hsqldb.nio_data_file true use of nio access methods for the .data file

    Setting this property to false will avoid the use of nio access methods, resulting in somewhat reduced speed. If the data file is larger than hsqldb.nio_max_size (default 256MB) when it is first opened (or when its size is increased), nio access methods are not used. Also, if the file gets larger than the amount of available computer memory that needs to be allocated for nio access, non-nio access methods are used.

    SET FILES NIO { TRUE | FALSE }

    Table 12.57. Use of NIO for Disk Table Storage

    NameDefaultDescription
    hsqldb.nio_max_size 256 nio buffer size limit

    The maximum size of .data file in mega bytes that can use the nio access method. When the file gets larger than this limit, non-nio access methods are used. Values 64, 128, 256, 512, 1024, and larger multiples of 512 can be used. The default is 256MB.

    SET FILES NIO SIZE <numeric value>

    Table 12.58. Recovery Log Processing

    NameDefaultDescription
    hsqldb.full_log_replay false recovery log processing

    The .log file is processed during recovery after a forced shutdwon. Out of memory conditions always abort the startup. Any other exception stops the processing of the .log file and by default, continues the startup process. If this property is true, the startup process is stopped if any exception occurs. Exceptions are usually caused by incomplete lines of SQL statements near the end of the .log file, which were not fully synced to disk when an abnormal shutdown occurred.

    This property cannot be set with an SQL statement

    Table 12.59. Default Properties for TEXT Tables

    NameDefaultDescription
    textdb.* 0 default properties for new text tables

    Properties that override the database engine defaults for newly created text tables. Settings in the text table SET <tablename> SOURCE <source string> command override both the engine defaults and the database properties defaults. Individual textdb.* properties are listed in the Text Tables chapter.


    Table 12.60. Forcing Garbage Collection

    NameDefaultDescription
    runtime.gc_interval 0 forced garbage collection

    This setting forces garbage collection each time a set number of result set row or cache row objects are created. The default, "0" means no garbage collection is forced by the program.

    SET DATABASE GC <numeric value>

    Crypt Properties

    Table 12.61. Crypt Property For LOBs

    NameDefaultDescription
    crypt_lobs false encryption of lobs

    If the property is true, the contents of the .lobs file is encrypted as well.

    this property cannot be set with an SQL statement

    Table 12.62. Cipher Key for Encrypted Database

    NameDefaultDescription
    crypt_key none encryption

    The cipher key for an encrypted database.

    this property cannot be set with an SQL statement

    Table 12.63. Crypt Provider Encrypted Database

    NameDefaultDescription
    crypt_provider none encryption

    The fully-qualified class name of the cryptography provider. This property is not used for the default security provider.

    this property cannot be set with an SQL statement

    Table 12.64. Cipher Specification for Encrypted Database

    NameDefaultDescription
    crypt_type none encryption

    The cipher specification.

    this property cannot be set with an SQL statement

    When connecting to an in-process database creates a new database, or opens an existing database (i.e. it is the first connection made to the database by the application), all the user-defined database properties listed in this section can be specified as URL properties.

    When HSQLDB is used with OpenOffice.org as an external database, the property "default_schema=true" must be set on the URL, otherwise the program will not operate correctly as it does with its built-in hsqldb instance.

    System Properties

    A few system properties are used by HyperSQL. These are set on the Java command line or by calling System.setProperty() from the user's program. They are not valid as URL or connection properties.

    Table 12.65. Logging Framework

    NameDefaultDescription
    hsqldb.reconfig_logging true configuring the framework logging

    Setting this system property false avoids reconfiguring the framework logging system such as Log4J or java.util.Logging. If the property does not exist or is true, reconfiguration takes place.


    Table 12.66. Text Tables

    NameDefaultDescription
    textdb.allow_full_path false text table file locations

    Setting this system property true allows text table sources and files to be opened on all available paths. It also allows pure mem: databases to open such files. By default, only the database directory and its subdirectories are allowed. See the Text Tables chapter.


    Table 12.67. Java Functions

    NameDefaultDescription
    hsqldb.method_class_names none allowed Java classes

    This property needs to be set with the names (including wildcards) of Java classes that can be used for routines based on Java static methods. See the SQL Invoked Routines chapter.

  • 相关阅读:
    WPF 前台处理绑定字段
    DataBinding?资料绑定? #4绑定表达式原来可以这样用?(DataSet / DataReader)
    DataBinding?资料绑定? #7 伤脑筋的 GridView加总、小计(原来如此 / 范例下载)
    实战ASP.NET MVC 1.0 #3,新增一笔资料(Create / Add)
    实战ASP.NET MVC 1.0 #1,我的第一支MVC程序,展现所有数据(主细表的Master)
    ASP.NET MVC与Web Form的使用时机?
    实战ASP.NET MVC 2.0 #5,删除一笔记录
    DataBinding?资料绑定? #3以DropDownList为例
    DataBinding?资料绑定? #5绑定表达式 与 ListView的HyperLink(超级链接)
    DataBinding?资料绑定? #6 伤脑筋的 GridView加总、小计(Question)
  • 原文地址:https://www.cnblogs.com/duanxz/p/3077125.html
Copyright © 2011-2022 走看看