SlideShare una empresa de Scribd logo
1 de 129
Descargar para leer sin conexión
H2 Database Engine
   Version 1.0 / 2006-10-10




                              1 of 129
Table of Contents
Quickstart............................................................................................................................................................................................... 9
    The H2 Console Application................................................................................................................................................................. 9
         Step-by-Step................................................................................................................................................................................ 9
              Installation............................................................................................................................................................................. 9
              Start the Console.................................................................................................................................................................... 9
              Login................................................................................................................................................................................... 10
              Sample................................................................................................................................................................................ 11
              Execute................................................................................................................................................................................ 12
              Disconnect........................................................................................................................................................................... 13
              End..................................................................................................................................................................................... 13
Installation............................................................................................................................................................................................ 14
    Requirements................................................................................................................................................................................... 14
    Supported Platforms......................................................................................................................................................................... 14
    Installing the Software...................................................................................................................................................................... 14
    Directory Structure........................................................................................................................................................................... 14
Tutorial................................................................................................................................................................................................. 15
    Starting and Using the H2 Console..................................................................................................................................................... 15
         Firewall...................................................................................................................................................................................... 15
         Native Version............................................................................................................................................................................ 15
         Testing Java............................................................................................................................................................................... 15
         Error Message 'Port is in use'....................................................................................................................................................... 16
         Using another Port...................................................................................................................................................................... 16
         Starting Successfully................................................................................................................................................................... 16
         Connecting to the Server using a Browser..................................................................................................................................... 16
         Multiple Concurrent Sessions....................................................................................................................................................... 16
         Application Properties................................................................................................................................................................. 16
         Login......................................................................................................................................................................................... 16
         Error Messages........................................................................................................................................................................... 16
         Adding Database Drivers............................................................................................................................................................. 16
         Using the Application.................................................................................................................................................................. 17
         Inserting Table Names or Column Names..................................................................................................................................... 17
         Disconnecting and Stopping the Application.................................................................................................................................. 17
    Connecting to a Database using JDBC................................................................................................................................................ 17
    Creating New Databases................................................................................................................................................................... 17
    Using the Server............................................................................................................................................................................... 17
         Limitations of the Server............................................................................................................................................................. 17
         Starting from Command Line....................................................................................................................................................... 17
         Starting within an Application...................................................................................................................................................... 18
         Stopping a TCP Server from Another Process................................................................................................................................ 18
    Using Hibernate............................................................................................................................................................................... 18
    Using Databases in Web Applications................................................................................................................................................. 18
         Embedded Mode......................................................................................................................................................................... 18
         Server Mode............................................................................................................................................................................... 19
         Using a Servlet Listener to Start and Stop a Database.................................................................................................................... 19
    CSV (Comma Separated Values) Support............................................................................................................................................ 19
         Writing a CSV File from Within a Database.................................................................................................................................... 19
         Reading a CSV File from Within a Database.................................................................................................................................. 19
         Writing a CSV File from a Java Application.................................................................................................................................... 20
         Reading a CSV File from a Java Application................................................................................................................................... 20
Features................................................................................................................................................................................................ 21
    Feature List...................................................................................................................................................................................... 21
         Main Features............................................................................................................................................................................ 21
         Additional Features..................................................................................................................................................................... 21
         SQL Support............................................................................................................................................................................... 21
         Security Features........................................................................................................................................................................ 22
         Other Features and Tools............................................................................................................................................................ 22
    Comparison to Other Database Engines.............................................................................................................................................. 22
    Products that Work with H2............................................................................................................................................................... 22
    Why Java......................................................................................................................................................................................... 23
    Connection Modes............................................................................................................................................................................ 23
    Database URL Overview.................................................................................................................................................................... 23
         Connecting to an Embedded (Local) Database............................................................................................................................... 24
         Memory-Only Databases............................................................................................................................................................. 24
    Connecting to a Database with File Encryption.................................................................................................................................... 24
    Database File Locking....................................................................................................................................................................... 24
    Opening a Database Only if it Already Exists....................................................................................................................................... 25
    Closing the Database........................................................................................................................................................................ 25
         Delayed Database Closing........................................................................................................................................................... 25
         Don't Close the Database when the VM Exists............................................................................................................................... 25
    Log Index Changes........................................................................................................................................................................... 25
         Ignore Unknown Settings............................................................................................................................................................ 25
         Changing Other Settings when Opening a Connection.................................................................................................................... 26


                                                                                                                                                                                    2 of 129
Multiple Connections.........................................................................................................................................................................         26
        Opening Multiple Databases at the Same Time..............................................................................................................................                         26
        Multiple Connections to the Same Database: Client/Server.............................................................................................................                             26
        Multithreading Support................................................................................................................................................................            26
        Locking, Lock-Timeout, Deadlocks................................................................................................................................................                  26
    Database File Layout........................................................................................................................................................................          27
        Moving and Renaming Database Files...........................................................................................................................................                     27
        Backup......................................................................................................................................................................................      27
    Logging and Recovery......................................................................................................................................................................            27
    Compatibility Modes..........................................................................................................................................................................         28
    Using the Trace Options....................................................................................................................................................................           28
        Trace Options.............................................................................................................................................................................        28
        Setting the Maximum Size of the Trace File...................................................................................................................................                     28
        Java Code Generation.................................................................................................................................................................             29
        Enabling the Trace Option at Runtime by Manually Creating a File..................................................................................................                                29
    Read Only Databases........................................................................................................................................................................           29
    Binary and Text Storage Formats.......................................................................................................................................................                29
    Graceful Handling of Low Disk Space Situations..................................................................................................................................                      29
        Opening a Corrupted Database....................................................................................................................................................                  30
    Computed Columns / Function Based Index........................................................................................................................................                       30
    Multi-Dimensional Indexes................................................................................................................................................................             30
    Using Passwords..............................................................................................................................................................................         30
        Using Secure Passwords..............................................................................................................................................................              30
        Passwords: Using Char Arrays instead of Strings...........................................................................................................................                        30
        Passing the User Name and/or Password in the URL......................................................................................................................                            31
    User Defined Functions and Stored Procedures...................................................................................................................................                       31
        Function Data Type Mapping.......................................................................................................................................................                 31
        Functions that require a Connection.............................................................................................................................................                  31
        Functions throwing an Exception..................................................................................................................................................                 31
        Functions returning a Result Set..................................................................................................................................................                32
        Using SimpleResultSet.................................................................................................................................................................            32
        Using a Function as a Table.........................................................................................................................................................              32
    Triggers...........................................................................................................................................................................................   33
    Compacting a Database....................................................................................................................................................................             33
Performance Comparison........................................................................................................................................................................            34
    Embedded.......................................................................................................................................................................................       34
    Client-Server....................................................................................................................................................................................     34
    PolePosition Benchmark....................................................................................................................................................................            34
    Benchmark Results and Comments....................................................................................................................................................                    35
        H2.............................................................................................................................................................................................   35
        HSQLDB.....................................................................................................................................................................................       35
        Derby........................................................................................................................................................................................     35
        PostgreSQL................................................................................................................................................................................        35
        MySQL.......................................................................................................................................................................................      35
        Firebird......................................................................................................................................................................................    36
        Why Oracle / MS SQL Server / DB2 are Not Listed.........................................................................................................................                          36
    About this Benchmark.......................................................................................................................................................................           36
        Number of Connections...............................................................................................................................................................              36
        Real-World Tests........................................................................................................................................................................          36
        Comparing Embedded with Server Databases................................................................................................................................                          36
        Test Platform.............................................................................................................................................................................        36
        Multiple Runs.............................................................................................................................................................................        36
        Memory Usage...........................................................................................................................................................................           36
        Delayed Operations....................................................................................................................................................................            36
        Transaction Commit / Durability...................................................................................................................................................                36
        Using Prepared Statements.........................................................................................................................................................                36
        Currently Not Tested: Startup Time..............................................................................................................................................                  37
Advanced Topics....................................................................................................................................................................................       38
    Performance Tuning.........................................................................................................................................................................           38
        Virus Scanners...........................................................................................................................................................................         38
        Index Usage...............................................................................................................................................................................        38
        Optimizer...................................................................................................................................................................................      38
        Expression Optimization..............................................................................................................................................................             38
        COUNT(*) Optimization...............................................................................................................................................................              38
        Updating Optimizer Statistics / Column Selectivity..........................................................................................................................                      38
    Result Sets......................................................................................................................................................................................     39
        Limiting the Number of Rows.......................................................................................................................................................                39
        Large Result Sets and External Sorting.........................................................................................................................................                   39
    Large Objects...................................................................................................................................................................................      39
        Storing and Reading Large Objects..............................................................................................................................................                   39
    Linked Tables...................................................................................................................................................................................      39
    Transaction Isolation........................................................................................................................................................................         39
        Table Level Locking....................................................................................................................................................................           39
        Lock Timeout.............................................................................................................................................................................         40
    Clustering / High Availability..............................................................................................................................................................          40
        Using the CreateCluster Tool.......................................................................................................................................................               40
    Two Phase Commit...........................................................................................................................................................................           41
    Compatibility....................................................................................................................................................................................     41


                                                                                                                                                                                     3 of 129
Transaction Commit when Autocommit is On................................................................................................................................                         41
        Keywords / Reserved Words........................................................................................................................................................                41
   ODBC Driver....................................................................................................................................................................................       41
        ODBC Installation.......................................................................................................................................................................         41
        Log Option.................................................................................................................................................................................      42
        Security Considerations...............................................................................................................................................................           42
        Uninstalling................................................................................................................................................................................     42
   ACID...............................................................................................................................................................................................   42
        Atomicity...................................................................................................................................................................................     42
        Consistency................................................................................................................................................................................      42
        Isolation....................................................................................................................................................................................    42
        Durability...................................................................................................................................................................................    43
        Running the Durability Test.........................................................................................................................................................             43
   Using the Recover Tool.....................................................................................................................................................................           43
   File Locking Protocols.......................................................................................................................................................................         43
        File Locking Method 'File'.............................................................................................................................................................          44
        File Locking Method 'Socket'........................................................................................................................................................             44
   Protection against SQL Injection........................................................................................................................................................              44
        What is SQL Injection.................................................................................................................................................................           44
        Disabling Literals........................................................................................................................................................................       45
        Using Constants.........................................................................................................................................................................         45
        Using the ZERO() Function..........................................................................................................................................................              45
   Security Protocols.............................................................................................................................................................................       45
        User Password Encryption...........................................................................................................................................................              45
        File Encryption............................................................................................................................................................................      46
        SSL/TLS Connections..................................................................................................................................................................            46
        HTTPS Connections....................................................................................................................................................................            46
   Universally Unique Identifiers (UUID).................................................................................................................................................                46
   Glossary and Links............................................................................................................................................................................        47
SQL Grammar........................................................................................................................................................................................      48
   Commands (Data Manipulation).........................................................................................................................................................                 48
   Commands (Data Definition).............................................................................................................................................................               48
   Commands (Other)...........................................................................................................................................................................           49
   Other Grammar................................................................................................................................................................................         49
        SELECT......................................................................................................................................................................................     50
        INSERT......................................................................................................................................................................................     50
        UPDATE.....................................................................................................................................................................................      50
        DELETE.....................................................................................................................................................................................      50
        CALL.........................................................................................................................................................................................    51
        EXPLAIN....................................................................................................................................................................................      51
        MERGE......................................................................................................................................................................................      51
        RUNSCRIPT................................................................................................................................................................................        51
        SCRIPT......................................................................................................................................................................................     52
        ALTER INDEX RENAME................................................................................................................................................................               52
        ALTER SEQUENCE......................................................................................................................................................................             52
        ALTER TABLE ADD......................................................................................................................................................................            52
        ALTER TABLE ADD CONSTRAINT.................................................................................................................................................                      52
        ALTER TABLE ALTER COLUMN.....................................................................................................................................................                    53
        ALTER TABLE ALTER COLUMN RENAME........................................................................................................................................                          53
        ALTER TABLE ALTER COLUMN RESTART......................................................................................................................................                           53
        ALTER TABLE ALTER COLUMN SELECTIVITY.................................................................................................................................                            53
        ALTER TABLE ALTER COLUMN SET DEFAULT................................................................................................................................                             53
        ALTER TABLE ALTER COLUMN SET NOT NULL..............................................................................................................................                              54
        ALTER TABLE ALTER COLUMN SET NULL......................................................................................................................................                          54
        ALTER TABLE DROP COLUMN......................................................................................................................................................                    54
        ALTER TABLE DROP CONSTRAINT...............................................................................................................................................                       54
        ALTER TABLE RENAME................................................................................................................................................................               54
        ALTER USER ADMIN...................................................................................................................................................................              54
        ALTER USER RENAME.................................................................................................................................................................               55
        ALTER USER SET PASSWORD......................................................................................................................................................                    55
        ALTER VIEW..............................................................................................................................................................................         55
        ANALYZE...................................................................................................................................................................................       55
        CREATE ALIAS............................................................................................................................................................................         55
        CREATE DOMAIN........................................................................................................................................................................            56
        CREATE INDEX...........................................................................................................................................................................          56
        CREATE LINKED TABLE...............................................................................................................................................................               56
        CREATE ROLE............................................................................................................................................................................          56
        CREATE SCHEMA........................................................................................................................................................................            56
        CREATE SEQUENCE....................................................................................................................................................................              57
        CREATE TABLE...........................................................................................................................................................................          57
        CREATE TRIGGER.......................................................................................................................................................................            57
        CREATE USER............................................................................................................................................................................          57
        CREATE VIEW............................................................................................................................................................................          58
        DROP ALIAS...............................................................................................................................................................................        58
        DROP ALL OBJECTS....................................................................................................................................................................             58
        DROP INDEX..............................................................................................................................................................................         58
        DROP ROLE...............................................................................................................................................................................         58
        DROP SEQUENCE.......................................................................................................................................................................             58


                                                                                                                                                                                    4 of 129
DROP SCHEMA...........................................................................................................................................................................             59
DROP TABLE..............................................................................................................................................................................           59
DROP TRIGGER..........................................................................................................................................................................             59
DROP USER...............................................................................................................................................................................           59
DROP VIEW...............................................................................................................................................................................           59
TRUNCATE TABLE......................................................................................................................................................................               59
COMMIT....................................................................................................................................................................................         60
COMMIT TRANSACTION..............................................................................................................................................................                   60
CHECKPOINT.............................................................................................................................................................................            60
CHECKPOINT SYNC....................................................................................................................................................................                60
GRANT RIGHT............................................................................................................................................................................            60
GRANT ROLE..............................................................................................................................................................................           60
HELP.........................................................................................................................................................................................      61
PREPARE COMMIT......................................................................................................................................................................               61
REVOKE RIGHT..........................................................................................................................................................................             61
REVOKE ROLE............................................................................................................................................................................            61
ROLLBACK.................................................................................................................................................................................          61
ROLLBACK TRANSACTION...........................................................................................................................................................                    61
SAVEPOINT................................................................................................................................................................................          62
SET ALLOW_LITERALS................................................................................................................................................................                 62
SET ASSERT...............................................................................................................................................................................          62
SET AUTOCOMMIT.....................................................................................................................................................................                62
SET CACHE_SIZE........................................................................................................................................................................             62
SET CLUSTER.............................................................................................................................................................................           63
SET COLLATION.........................................................................................................................................................................             63
SET COMPRESS_LOB..................................................................................................................................................................                 63
SET DATABASE_EVENT_LISTENER...............................................................................................................................................                         63
SET DB_CLOSE_DELAY...............................................................................................................................................................                  64
SET DEFAULT_LOCK_TIMEOUT...................................................................................................................................................                        64
SET DEFAULT_TABLE_TYPE........................................................................................................................................................                     64
SET IGNORECASE.......................................................................................................................................................................              64
SET LOCK_MODE........................................................................................................................................................................              65
SET LOCK_TIMEOUT...................................................................................................................................................................                65
SET LOG....................................................................................................................................................................................        65
SET MAX_LENGTH_INPLACE_LOB................................................................................................................................................                         65
SET MAX_LOG_SIZE...................................................................................................................................................................                66
SET MAX_MEMORY_ROWS..........................................................................................................................................................                      66
SET MAX_MEMORY_UNDO..........................................................................................................................................................                      66
SET MODE.................................................................................................................................................................................          66
SET MULTI_THREADED...............................................................................................................................................................                  67
SET PASSWORD.........................................................................................................................................................................              67
SET SALT HASH..........................................................................................................................................................................            67
SET THROTTLE..........................................................................................................................................................................             67
SET TRACE_LEVEL......................................................................................................................................................................              67
SET TRACE_MAX_FILE_SIZE........................................................................................................................................................                    68
SET WRITE_DELAY.....................................................................................................................................................................               68
SHUTDOWN...............................................................................................................................................................................            68
Comment...................................................................................................................................................................................         68
Select Part.................................................................................................................................................................................       68
From Part..................................................................................................................................................................................        69
Constraint..................................................................................................................................................................................       69
Referential Constraint.................................................................................................................................................................            69
Table Expression........................................................................................................................................................................           69
Order........................................................................................................................................................................................      69
Expression.................................................................................................................................................................................        70
And Condition............................................................................................................................................................................          70
Condition...................................................................................................................................................................................       70
Condition Right Hand Side...........................................................................................................................................................               70
Compare....................................................................................................................................................................................        70
Operand....................................................................................................................................................................................        70
Summand..................................................................................................................................................................................          71
Factor........................................................................................................................................................................................     71
Term.........................................................................................................................................................................................      71
Value.........................................................................................................................................................................................     71
Case..........................................................................................................................................................................................     71
Case When................................................................................................................................................................................          72
Cipher.......................................................................................................................................................................................      72
Select Expression........................................................................................................................................................................          72
Data Type..................................................................................................................................................................................        72
Name........................................................................................................................................................................................       72
Alias..........................................................................................................................................................................................    72
Quoted Name.............................................................................................................................................................................           73
String........................................................................................................................................................................................     73
Int.............................................................................................................................................................................................   73
Long..........................................................................................................................................................................................     73
Hex Number...............................................................................................................................................................................          73
Decimal.....................................................................................................................................................................................       73
Double.......................................................................................................................................................................................      74


                                                                                                                                                                              5 of 129
Date..........................................................................................................................................................................................     74
        Time..........................................................................................................................................................................................     74
        Timestamp.................................................................................................................................................................................         74
        Boolean.....................................................................................................................................................................................       74
        Bytes.........................................................................................................................................................................................     74
        Null...........................................................................................................................................................................................    75
        Hex...........................................................................................................................................................................................     75
        Digit..........................................................................................................................................................................................    75
Functions..............................................................................................................................................................................................    76
   Aggregate Functions.........................................................................................................................................................................            76
   Numeric Functions............................................................................................................................................................................           76
   String Functions...............................................................................................................................................................................         76
   Time and Date Functions..................................................................................................................................................................               77
   System Functions.............................................................................................................................................................................           77
        AVG...........................................................................................................................................................................................     78
        COUNT......................................................................................................................................................................................        78
        GROUP_CONCAT........................................................................................................................................................................               78
        MAX..........................................................................................................................................................................................      78
        MIN...........................................................................................................................................................................................     78
        SUM..........................................................................................................................................................................................      78
        SELECTIVITY.............................................................................................................................................................................           79
        STDDEV_POP.............................................................................................................................................................................            79
        STDDEV_SAMP...........................................................................................................................................................................             79
        VAR_POP...................................................................................................................................................................................         79
        VAR_SAMP.................................................................................................................................................................................          79
        ABS...........................................................................................................................................................................................     79
        ACOS.........................................................................................................................................................................................      80
        ASIN.........................................................................................................................................................................................      80
        ATAN.........................................................................................................................................................................................      80
        COS...........................................................................................................................................................................................     80
        COT..........................................................................................................................................................................................      80
        SIN...........................................................................................................................................................................................     80
        TAN...........................................................................................................................................................................................     81
        ATAN2.......................................................................................................................................................................................       81
        BITAND.....................................................................................................................................................................................        81
        BITOR.......................................................................................................................................................................................       81
        BITXOR.....................................................................................................................................................................................        81
        MOD..........................................................................................................................................................................................      81
        CEILING....................................................................................................................................................................................        82
        DEGREES...................................................................................................................................................................................         82
        EXP...........................................................................................................................................................................................     82
        FLOOR.......................................................................................................................................................................................       82
        LOG...........................................................................................................................................................................................     82
        LOG10.......................................................................................................................................................................................       82
        RADIANS...................................................................................................................................................................................         83
        SQRT.........................................................................................................................................................................................      83
        PI..............................................................................................................................................................................................   83
        POWER......................................................................................................................................................................................        83
        RAND........................................................................................................................................................................................       83
        RANDOM_UUID..........................................................................................................................................................................              83
        ROUND......................................................................................................................................................................................        84
        ROUNDMAGIC............................................................................................................................................................................             84
        SECURE_RAND...........................................................................................................................................................................             84
        SIGN.........................................................................................................................................................................................      84
        ENCRYPT...................................................................................................................................................................................         84
        DECRYPT...................................................................................................................................................................................         84
        HASH........................................................................................................................................................................................       85
        TRUNCATE.................................................................................................................................................................................          85
        COMPRESS.................................................................................................................................................................................          85
        EXPAND.....................................................................................................................................................................................        85
        ZERO.........................................................................................................................................................................................      85
        ASCII........................................................................................................................................................................................      85
        BIT_LENGTH..............................................................................................................................................................................           86
        LENGTH.....................................................................................................................................................................................        86
        OCTET_LENGTH.........................................................................................................................................................................              86
        CHAR........................................................................................................................................................................................       86
        CONCAT....................................................................................................................................................................................         86
        DIFFERENCE..............................................................................................................................................................................           86
        HEXTORAW................................................................................................................................................................................           87
        RAWTOHEX................................................................................................................................................................................           87
        INSTR.......................................................................................................................................................................................       87
        INSERT Function........................................................................................................................................................................            87
        LOWER......................................................................................................................................................................................        87
        UPPER.......................................................................................................................................................................................       87
        LEFT..........................................................................................................................................................................................     88
        RIGHT.......................................................................................................................................................................................       88
        LOCATE.....................................................................................................................................................................................        88
        POSITION..................................................................................................................................................................................         88


                                                                                                                                                                                      6 of 129
LTRIM....................................................................................................................................................................................... 88
       RTRIM....................................................................................................................................................................................... 88
       TRIM......................................................................................................................................................................................... 89
       REPEAT..................................................................................................................................................................................... 89
       REPLACE.................................................................................................................................................................................... 89
       SOUNDEX.................................................................................................................................................................................. 89
       SPACE....................................................................................................................................................................................... 89
       STRINGDECODE......................................................................................................................................................................... 89
       STRINGENCODE......................................................................................................................................................................... 90
       STRINGTOUTF8.......................................................................................................................................................................... 90
       SUBSTRING............................................................................................................................................................................... 90
       UTF8TOSTRING.......................................................................................................................................................................... 90
       XMLATTR................................................................................................................................................................................... 90
       XMLNODE.................................................................................................................................................................................. 90
       XMLCOMMENT........................................................................................................................................................................... 91
       XMLCDATA................................................................................................................................................................................. 91
       XMLSTARTDOC.......................................................................................................................................................................... 91
       XMLTEXT................................................................................................................................................................................... 91
       AUTOCOMMIT............................................................................................................................................................................ 91
       CASEWHEN Function................................................................................................................................................................... 91
       CAST......................................................................................................................................................................................... 92
       COALESCE................................................................................................................................................................................. 92
       CONVERT.................................................................................................................................................................................. 92
       CURRVAL................................................................................................................................................................................... 92
       CSVREAD................................................................................................................................................................................... 92
       CSVWRITE................................................................................................................................................................................. 92
       DATABASE................................................................................................................................................................................. 93
       DATABASE_PATH....................................................................................................................................................................... 93
       IDENTITY.................................................................................................................................................................................. 93
       IFNULL...................................................................................................................................................................................... 93
       LOCK_MODE.............................................................................................................................................................................. 93
       LOCK_TIMEOUT......................................................................................................................................................................... 93
       MEMORY_FREE.......................................................................................................................................................................... 94
       MEMORY_USED.......................................................................................................................................................................... 94
       NEXTVAL................................................................................................................................................................................... 94
       NULLIF...................................................................................................................................................................................... 94
       READONLY................................................................................................................................................................................. 94
       ROWNUM................................................................................................................................................................................... 94
       USER......................................................................................................................................................................................... 95
       CURRENT_DATE......................................................................................................................................................................... 95
       CURRENT_TIME......................................................................................................................................................................... 95
       CURRENT_TIMESTAMP............................................................................................................................................................... 95
       DATEADD.................................................................................................................................................................................. 95
       DATEDIFF.................................................................................................................................................................................. 95
       DAYNAME.................................................................................................................................................................................. 96
       DAYOFMONTH........................................................................................................................................................................... 96
       DAYOFWEEK.............................................................................................................................................................................. 96
       DAYOFYEAR............................................................................................................................................................................... 96
       EXTRACT................................................................................................................................................................................... 96
       FORMATDATETIME..................................................................................................................................................................... 96
       HOUR........................................................................................................................................................................................ 97
       MINUTE..................................................................................................................................................................................... 97
       MONTH...................................................................................................................................................................................... 97
       MONTHNAME............................................................................................................................................................................. 97
       PARSEDATETIME........................................................................................................................................................................ 97
       QUARTER.................................................................................................................................................................................. 97
       SECOND.................................................................................................................................................................................... 98
       WEEK........................................................................................................................................................................................ 98
       YEAR......................................................................................................................................................................................... 98
Data Types............................................................................................................................................................................................ 99
       INT Type................................................................................................................................................................................... 99
       BOOLEAN Type.......................................................................................................................................................................... 99
       TINYINT Type............................................................................................................................................................................ 99
       SMALLINT Type.......................................................................................................................................................................... 99
       BIGINT Type............................................................................................................................................................................ 100
       IDENTITY Type........................................................................................................................................................................ 100
       DECIMAL Type......................................................................................................................................................................... 100
       DOUBLE Type........................................................................................................................................................................... 100
       REAL Type............................................................................................................................................................................... 100
       TIME Type............................................................................................................................................................................... 100
       DATE Type............................................................................................................................................................................... 101
       TIMESTAMP Type..................................................................................................................................................................... 101
       BINARY Type............................................................................................................................................................................ 101
       OTHER Type............................................................................................................................................................................ 101
       VARCHAR Type......................................................................................................................................................................... 101
       VARCHAR_IGNORECASE Type.................................................................................................................................................... 102
       BLOB Type............................................................................................................................................................................... 102
       CLOB Type............................................................................................................................................................................... 102


                                                                                                                                                                                  7 of 129
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database
H2 Database New generation embeded database

Más contenido relacionado

Similar a H2 Database New generation embeded database

Pelco c4654 m a-dx-series-client
Pelco c4654 m a-dx-series-clientPelco c4654 m a-dx-series-client
Pelco c4654 m a-dx-series-clientmarco rios
 
Teamviewer manual
Teamviewer manualTeamviewer manual
Teamviewer manualjeetjsr11
 
Teamviewer manual
Teamviewer manualTeamviewer manual
Teamviewer manualEroel Irzha
 
Teamviewer manual
Teamviewer manualTeamviewer manual
Teamviewer manualjeetjsr11
 
PT - Siemens WinCC Flexible Security Hardening Guide
PT - Siemens WinCC Flexible Security Hardening GuidePT - Siemens WinCC Flexible Security Hardening Guide
PT - Siemens WinCC Flexible Security Hardening Guideqqlan
 
Lync server2010licensingguide en-us
Lync server2010licensingguide en-usLync server2010licensingguide en-us
Lync server2010licensingguide en-usallegra601
 
Ge Steam Turbinesfor Industrial
Ge Steam Turbinesfor IndustrialGe Steam Turbinesfor Industrial
Ge Steam Turbinesfor IndustrialAmericanMillwright
 
M Daemon E Mail Server Manual
M Daemon E Mail Server ManualM Daemon E Mail Server Manual
M Daemon E Mail Server Manualguestcf19c83
 
TRU_v29_Reference_Manual_EN_20140325.pdf
TRU_v29_Reference_Manual_EN_20140325.pdfTRU_v29_Reference_Manual_EN_20140325.pdf
TRU_v29_Reference_Manual_EN_20140325.pdfPEDRO MORALES HERNANDEZ
 
Hypermedia Telular manual-ver5
Hypermedia Telular manual-ver5Hypermedia Telular manual-ver5
Hypermedia Telular manual-ver5Victor Jaramillo
 
Guia do usuario para interface web do at 8000 s
Guia do usuario para interface web do at 8000 sGuia do usuario para interface web do at 8000 s
Guia do usuario para interface web do at 8000 sNetPlus
 
Vivitek User Manual H9080 Fd
Vivitek User Manual H9080 FdVivitek User Manual H9080 Fd
Vivitek User Manual H9080 Fdprojectiondreams
 
Administrator guide
Administrator guideAdministrator guide
Administrator guiderturkman
 
Firewall and proxy servers howto
Firewall and proxy servers howtoFirewall and proxy servers howto
Firewall and proxy servers howtoKumar
 
Zeta Producer 9 CMS online manual
Zeta Producer 9 CMS online manualZeta Producer 9 CMS online manual
Zeta Producer 9 CMS online manualUwe Keim
 

Similar a H2 Database New generation embeded database (20)

C2675m c
C2675m cC2675m c
C2675m c
 
Reseller's Guide
Reseller's GuideReseller's Guide
Reseller's Guide
 
C01508406
C01508406C01508406
C01508406
 
2 x applicationserver
2 x applicationserver2 x applicationserver
2 x applicationserver
 
Diamond
DiamondDiamond
Diamond
 
Pelco c4654 m a-dx-series-client
Pelco c4654 m a-dx-series-clientPelco c4654 m a-dx-series-client
Pelco c4654 m a-dx-series-client
 
Teamviewer manual
Teamviewer manualTeamviewer manual
Teamviewer manual
 
Teamviewer manual
Teamviewer manualTeamviewer manual
Teamviewer manual
 
Teamviewer manual
Teamviewer manualTeamviewer manual
Teamviewer manual
 
PT - Siemens WinCC Flexible Security Hardening Guide
PT - Siemens WinCC Flexible Security Hardening GuidePT - Siemens WinCC Flexible Security Hardening Guide
PT - Siemens WinCC Flexible Security Hardening Guide
 
Lync server2010licensingguide en-us
Lync server2010licensingguide en-usLync server2010licensingguide en-us
Lync server2010licensingguide en-us
 
Ge Steam Turbinesfor Industrial
Ge Steam Turbinesfor IndustrialGe Steam Turbinesfor Industrial
Ge Steam Turbinesfor Industrial
 
M Daemon E Mail Server Manual
M Daemon E Mail Server ManualM Daemon E Mail Server Manual
M Daemon E Mail Server Manual
 
TRU_v29_Reference_Manual_EN_20140325.pdf
TRU_v29_Reference_Manual_EN_20140325.pdfTRU_v29_Reference_Manual_EN_20140325.pdf
TRU_v29_Reference_Manual_EN_20140325.pdf
 
Hypermedia Telular manual-ver5
Hypermedia Telular manual-ver5Hypermedia Telular manual-ver5
Hypermedia Telular manual-ver5
 
Guia do usuario para interface web do at 8000 s
Guia do usuario para interface web do at 8000 sGuia do usuario para interface web do at 8000 s
Guia do usuario para interface web do at 8000 s
 
Vivitek User Manual H9080 Fd
Vivitek User Manual H9080 FdVivitek User Manual H9080 Fd
Vivitek User Manual H9080 Fd
 
Administrator guide
Administrator guideAdministrator guide
Administrator guide
 
Firewall and proxy servers howto
Firewall and proxy servers howtoFirewall and proxy servers howto
Firewall and proxy servers howto
 
Zeta Producer 9 CMS online manual
Zeta Producer 9 CMS online manualZeta Producer 9 CMS online manual
Zeta Producer 9 CMS online manual
 

Más de Sanjeev Kulkarni

Jfreereport and Charts an essential Report generation tool for Java Developers
Jfreereport and Charts an essential Report generation tool for Java DevelopersJfreereport and Charts an essential Report generation tool for Java Developers
Jfreereport and Charts an essential Report generation tool for Java DevelopersSanjeev Kulkarni
 

Más de Sanjeev Kulkarni (6)

Gooogle Web Toolkit
Gooogle Web ToolkitGooogle Web Toolkit
Gooogle Web Toolkit
 
Orcale Presentation
Orcale PresentationOrcale Presentation
Orcale Presentation
 
Jfreereport and Charts an essential Report generation tool for Java Developers
Jfreereport and Charts an essential Report generation tool for Java DevelopersJfreereport and Charts an essential Report generation tool for Java Developers
Jfreereport and Charts an essential Report generation tool for Java Developers
 
Only In India
Only In IndiaOnly In India
Only In India
 
The Woman
The Woman The Woman
The Woman
 
What is meant by Love???
What is meant by Love???What is meant by Love???
What is meant by Love???
 

Último

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 

Último (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

H2 Database New generation embeded database

  • 1. H2 Database Engine Version 1.0 / 2006-10-10 1 of 129
  • 2. Table of Contents Quickstart............................................................................................................................................................................................... 9 The H2 Console Application................................................................................................................................................................. 9 Step-by-Step................................................................................................................................................................................ 9 Installation............................................................................................................................................................................. 9 Start the Console.................................................................................................................................................................... 9 Login................................................................................................................................................................................... 10 Sample................................................................................................................................................................................ 11 Execute................................................................................................................................................................................ 12 Disconnect........................................................................................................................................................................... 13 End..................................................................................................................................................................................... 13 Installation............................................................................................................................................................................................ 14 Requirements................................................................................................................................................................................... 14 Supported Platforms......................................................................................................................................................................... 14 Installing the Software...................................................................................................................................................................... 14 Directory Structure........................................................................................................................................................................... 14 Tutorial................................................................................................................................................................................................. 15 Starting and Using the H2 Console..................................................................................................................................................... 15 Firewall...................................................................................................................................................................................... 15 Native Version............................................................................................................................................................................ 15 Testing Java............................................................................................................................................................................... 15 Error Message 'Port is in use'....................................................................................................................................................... 16 Using another Port...................................................................................................................................................................... 16 Starting Successfully................................................................................................................................................................... 16 Connecting to the Server using a Browser..................................................................................................................................... 16 Multiple Concurrent Sessions....................................................................................................................................................... 16 Application Properties................................................................................................................................................................. 16 Login......................................................................................................................................................................................... 16 Error Messages........................................................................................................................................................................... 16 Adding Database Drivers............................................................................................................................................................. 16 Using the Application.................................................................................................................................................................. 17 Inserting Table Names or Column Names..................................................................................................................................... 17 Disconnecting and Stopping the Application.................................................................................................................................. 17 Connecting to a Database using JDBC................................................................................................................................................ 17 Creating New Databases................................................................................................................................................................... 17 Using the Server............................................................................................................................................................................... 17 Limitations of the Server............................................................................................................................................................. 17 Starting from Command Line....................................................................................................................................................... 17 Starting within an Application...................................................................................................................................................... 18 Stopping a TCP Server from Another Process................................................................................................................................ 18 Using Hibernate............................................................................................................................................................................... 18 Using Databases in Web Applications................................................................................................................................................. 18 Embedded Mode......................................................................................................................................................................... 18 Server Mode............................................................................................................................................................................... 19 Using a Servlet Listener to Start and Stop a Database.................................................................................................................... 19 CSV (Comma Separated Values) Support............................................................................................................................................ 19 Writing a CSV File from Within a Database.................................................................................................................................... 19 Reading a CSV File from Within a Database.................................................................................................................................. 19 Writing a CSV File from a Java Application.................................................................................................................................... 20 Reading a CSV File from a Java Application................................................................................................................................... 20 Features................................................................................................................................................................................................ 21 Feature List...................................................................................................................................................................................... 21 Main Features............................................................................................................................................................................ 21 Additional Features..................................................................................................................................................................... 21 SQL Support............................................................................................................................................................................... 21 Security Features........................................................................................................................................................................ 22 Other Features and Tools............................................................................................................................................................ 22 Comparison to Other Database Engines.............................................................................................................................................. 22 Products that Work with H2............................................................................................................................................................... 22 Why Java......................................................................................................................................................................................... 23 Connection Modes............................................................................................................................................................................ 23 Database URL Overview.................................................................................................................................................................... 23 Connecting to an Embedded (Local) Database............................................................................................................................... 24 Memory-Only Databases............................................................................................................................................................. 24 Connecting to a Database with File Encryption.................................................................................................................................... 24 Database File Locking....................................................................................................................................................................... 24 Opening a Database Only if it Already Exists....................................................................................................................................... 25 Closing the Database........................................................................................................................................................................ 25 Delayed Database Closing........................................................................................................................................................... 25 Don't Close the Database when the VM Exists............................................................................................................................... 25 Log Index Changes........................................................................................................................................................................... 25 Ignore Unknown Settings............................................................................................................................................................ 25 Changing Other Settings when Opening a Connection.................................................................................................................... 26 2 of 129
  • 3. Multiple Connections......................................................................................................................................................................... 26 Opening Multiple Databases at the Same Time.............................................................................................................................. 26 Multiple Connections to the Same Database: Client/Server............................................................................................................. 26 Multithreading Support................................................................................................................................................................ 26 Locking, Lock-Timeout, Deadlocks................................................................................................................................................ 26 Database File Layout........................................................................................................................................................................ 27 Moving and Renaming Database Files........................................................................................................................................... 27 Backup...................................................................................................................................................................................... 27 Logging and Recovery...................................................................................................................................................................... 27 Compatibility Modes.......................................................................................................................................................................... 28 Using the Trace Options.................................................................................................................................................................... 28 Trace Options............................................................................................................................................................................. 28 Setting the Maximum Size of the Trace File................................................................................................................................... 28 Java Code Generation................................................................................................................................................................. 29 Enabling the Trace Option at Runtime by Manually Creating a File.................................................................................................. 29 Read Only Databases........................................................................................................................................................................ 29 Binary and Text Storage Formats....................................................................................................................................................... 29 Graceful Handling of Low Disk Space Situations.................................................................................................................................. 29 Opening a Corrupted Database.................................................................................................................................................... 30 Computed Columns / Function Based Index........................................................................................................................................ 30 Multi-Dimensional Indexes................................................................................................................................................................ 30 Using Passwords.............................................................................................................................................................................. 30 Using Secure Passwords.............................................................................................................................................................. 30 Passwords: Using Char Arrays instead of Strings........................................................................................................................... 30 Passing the User Name and/or Password in the URL...................................................................................................................... 31 User Defined Functions and Stored Procedures................................................................................................................................... 31 Function Data Type Mapping....................................................................................................................................................... 31 Functions that require a Connection............................................................................................................................................. 31 Functions throwing an Exception.................................................................................................................................................. 31 Functions returning a Result Set.................................................................................................................................................. 32 Using SimpleResultSet................................................................................................................................................................. 32 Using a Function as a Table......................................................................................................................................................... 32 Triggers........................................................................................................................................................................................... 33 Compacting a Database.................................................................................................................................................................... 33 Performance Comparison........................................................................................................................................................................ 34 Embedded....................................................................................................................................................................................... 34 Client-Server.................................................................................................................................................................................... 34 PolePosition Benchmark.................................................................................................................................................................... 34 Benchmark Results and Comments.................................................................................................................................................... 35 H2............................................................................................................................................................................................. 35 HSQLDB..................................................................................................................................................................................... 35 Derby........................................................................................................................................................................................ 35 PostgreSQL................................................................................................................................................................................ 35 MySQL....................................................................................................................................................................................... 35 Firebird...................................................................................................................................................................................... 36 Why Oracle / MS SQL Server / DB2 are Not Listed......................................................................................................................... 36 About this Benchmark....................................................................................................................................................................... 36 Number of Connections............................................................................................................................................................... 36 Real-World Tests........................................................................................................................................................................ 36 Comparing Embedded with Server Databases................................................................................................................................ 36 Test Platform............................................................................................................................................................................. 36 Multiple Runs............................................................................................................................................................................. 36 Memory Usage........................................................................................................................................................................... 36 Delayed Operations.................................................................................................................................................................... 36 Transaction Commit / Durability................................................................................................................................................... 36 Using Prepared Statements......................................................................................................................................................... 36 Currently Not Tested: Startup Time.............................................................................................................................................. 37 Advanced Topics.................................................................................................................................................................................... 38 Performance Tuning......................................................................................................................................................................... 38 Virus Scanners........................................................................................................................................................................... 38 Index Usage............................................................................................................................................................................... 38 Optimizer................................................................................................................................................................................... 38 Expression Optimization.............................................................................................................................................................. 38 COUNT(*) Optimization............................................................................................................................................................... 38 Updating Optimizer Statistics / Column Selectivity.......................................................................................................................... 38 Result Sets...................................................................................................................................................................................... 39 Limiting the Number of Rows....................................................................................................................................................... 39 Large Result Sets and External Sorting......................................................................................................................................... 39 Large Objects................................................................................................................................................................................... 39 Storing and Reading Large Objects.............................................................................................................................................. 39 Linked Tables................................................................................................................................................................................... 39 Transaction Isolation........................................................................................................................................................................ 39 Table Level Locking.................................................................................................................................................................... 39 Lock Timeout............................................................................................................................................................................. 40 Clustering / High Availability.............................................................................................................................................................. 40 Using the CreateCluster Tool....................................................................................................................................................... 40 Two Phase Commit........................................................................................................................................................................... 41 Compatibility.................................................................................................................................................................................... 41 3 of 129
  • 4. Transaction Commit when Autocommit is On................................................................................................................................ 41 Keywords / Reserved Words........................................................................................................................................................ 41 ODBC Driver.................................................................................................................................................................................... 41 ODBC Installation....................................................................................................................................................................... 41 Log Option................................................................................................................................................................................. 42 Security Considerations............................................................................................................................................................... 42 Uninstalling................................................................................................................................................................................ 42 ACID............................................................................................................................................................................................... 42 Atomicity................................................................................................................................................................................... 42 Consistency................................................................................................................................................................................ 42 Isolation.................................................................................................................................................................................... 42 Durability................................................................................................................................................................................... 43 Running the Durability Test......................................................................................................................................................... 43 Using the Recover Tool..................................................................................................................................................................... 43 File Locking Protocols....................................................................................................................................................................... 43 File Locking Method 'File'............................................................................................................................................................. 44 File Locking Method 'Socket'........................................................................................................................................................ 44 Protection against SQL Injection........................................................................................................................................................ 44 What is SQL Injection................................................................................................................................................................. 44 Disabling Literals........................................................................................................................................................................ 45 Using Constants......................................................................................................................................................................... 45 Using the ZERO() Function.......................................................................................................................................................... 45 Security Protocols............................................................................................................................................................................. 45 User Password Encryption........................................................................................................................................................... 45 File Encryption............................................................................................................................................................................ 46 SSL/TLS Connections.................................................................................................................................................................. 46 HTTPS Connections.................................................................................................................................................................... 46 Universally Unique Identifiers (UUID)................................................................................................................................................. 46 Glossary and Links............................................................................................................................................................................ 47 SQL Grammar........................................................................................................................................................................................ 48 Commands (Data Manipulation)......................................................................................................................................................... 48 Commands (Data Definition)............................................................................................................................................................. 48 Commands (Other)........................................................................................................................................................................... 49 Other Grammar................................................................................................................................................................................ 49 SELECT...................................................................................................................................................................................... 50 INSERT...................................................................................................................................................................................... 50 UPDATE..................................................................................................................................................................................... 50 DELETE..................................................................................................................................................................................... 50 CALL......................................................................................................................................................................................... 51 EXPLAIN.................................................................................................................................................................................... 51 MERGE...................................................................................................................................................................................... 51 RUNSCRIPT................................................................................................................................................................................ 51 SCRIPT...................................................................................................................................................................................... 52 ALTER INDEX RENAME................................................................................................................................................................ 52 ALTER SEQUENCE...................................................................................................................................................................... 52 ALTER TABLE ADD...................................................................................................................................................................... 52 ALTER TABLE ADD CONSTRAINT................................................................................................................................................. 52 ALTER TABLE ALTER COLUMN..................................................................................................................................................... 53 ALTER TABLE ALTER COLUMN RENAME........................................................................................................................................ 53 ALTER TABLE ALTER COLUMN RESTART...................................................................................................................................... 53 ALTER TABLE ALTER COLUMN SELECTIVITY................................................................................................................................. 53 ALTER TABLE ALTER COLUMN SET DEFAULT................................................................................................................................ 53 ALTER TABLE ALTER COLUMN SET NOT NULL.............................................................................................................................. 54 ALTER TABLE ALTER COLUMN SET NULL...................................................................................................................................... 54 ALTER TABLE DROP COLUMN...................................................................................................................................................... 54 ALTER TABLE DROP CONSTRAINT............................................................................................................................................... 54 ALTER TABLE RENAME................................................................................................................................................................ 54 ALTER USER ADMIN................................................................................................................................................................... 54 ALTER USER RENAME................................................................................................................................................................. 55 ALTER USER SET PASSWORD...................................................................................................................................................... 55 ALTER VIEW.............................................................................................................................................................................. 55 ANALYZE................................................................................................................................................................................... 55 CREATE ALIAS............................................................................................................................................................................ 55 CREATE DOMAIN........................................................................................................................................................................ 56 CREATE INDEX........................................................................................................................................................................... 56 CREATE LINKED TABLE............................................................................................................................................................... 56 CREATE ROLE............................................................................................................................................................................ 56 CREATE SCHEMA........................................................................................................................................................................ 56 CREATE SEQUENCE.................................................................................................................................................................... 57 CREATE TABLE........................................................................................................................................................................... 57 CREATE TRIGGER....................................................................................................................................................................... 57 CREATE USER............................................................................................................................................................................ 57 CREATE VIEW............................................................................................................................................................................ 58 DROP ALIAS............................................................................................................................................................................... 58 DROP ALL OBJECTS.................................................................................................................................................................... 58 DROP INDEX.............................................................................................................................................................................. 58 DROP ROLE............................................................................................................................................................................... 58 DROP SEQUENCE....................................................................................................................................................................... 58 4 of 129
  • 5. DROP SCHEMA........................................................................................................................................................................... 59 DROP TABLE.............................................................................................................................................................................. 59 DROP TRIGGER.......................................................................................................................................................................... 59 DROP USER............................................................................................................................................................................... 59 DROP VIEW............................................................................................................................................................................... 59 TRUNCATE TABLE...................................................................................................................................................................... 59 COMMIT.................................................................................................................................................................................... 60 COMMIT TRANSACTION.............................................................................................................................................................. 60 CHECKPOINT............................................................................................................................................................................. 60 CHECKPOINT SYNC.................................................................................................................................................................... 60 GRANT RIGHT............................................................................................................................................................................ 60 GRANT ROLE.............................................................................................................................................................................. 60 HELP......................................................................................................................................................................................... 61 PREPARE COMMIT...................................................................................................................................................................... 61 REVOKE RIGHT.......................................................................................................................................................................... 61 REVOKE ROLE............................................................................................................................................................................ 61 ROLLBACK................................................................................................................................................................................. 61 ROLLBACK TRANSACTION........................................................................................................................................................... 61 SAVEPOINT................................................................................................................................................................................ 62 SET ALLOW_LITERALS................................................................................................................................................................ 62 SET ASSERT............................................................................................................................................................................... 62 SET AUTOCOMMIT..................................................................................................................................................................... 62 SET CACHE_SIZE........................................................................................................................................................................ 62 SET CLUSTER............................................................................................................................................................................. 63 SET COLLATION......................................................................................................................................................................... 63 SET COMPRESS_LOB.................................................................................................................................................................. 63 SET DATABASE_EVENT_LISTENER............................................................................................................................................... 63 SET DB_CLOSE_DELAY............................................................................................................................................................... 64 SET DEFAULT_LOCK_TIMEOUT................................................................................................................................................... 64 SET DEFAULT_TABLE_TYPE........................................................................................................................................................ 64 SET IGNORECASE....................................................................................................................................................................... 64 SET LOCK_MODE........................................................................................................................................................................ 65 SET LOCK_TIMEOUT................................................................................................................................................................... 65 SET LOG.................................................................................................................................................................................... 65 SET MAX_LENGTH_INPLACE_LOB................................................................................................................................................ 65 SET MAX_LOG_SIZE................................................................................................................................................................... 66 SET MAX_MEMORY_ROWS.......................................................................................................................................................... 66 SET MAX_MEMORY_UNDO.......................................................................................................................................................... 66 SET MODE................................................................................................................................................................................. 66 SET MULTI_THREADED............................................................................................................................................................... 67 SET PASSWORD......................................................................................................................................................................... 67 SET SALT HASH.......................................................................................................................................................................... 67 SET THROTTLE.......................................................................................................................................................................... 67 SET TRACE_LEVEL...................................................................................................................................................................... 67 SET TRACE_MAX_FILE_SIZE........................................................................................................................................................ 68 SET WRITE_DELAY..................................................................................................................................................................... 68 SHUTDOWN............................................................................................................................................................................... 68 Comment................................................................................................................................................................................... 68 Select Part................................................................................................................................................................................. 68 From Part.................................................................................................................................................................................. 69 Constraint.................................................................................................................................................................................. 69 Referential Constraint................................................................................................................................................................. 69 Table Expression........................................................................................................................................................................ 69 Order........................................................................................................................................................................................ 69 Expression................................................................................................................................................................................. 70 And Condition............................................................................................................................................................................ 70 Condition................................................................................................................................................................................... 70 Condition Right Hand Side........................................................................................................................................................... 70 Compare.................................................................................................................................................................................... 70 Operand.................................................................................................................................................................................... 70 Summand.................................................................................................................................................................................. 71 Factor........................................................................................................................................................................................ 71 Term......................................................................................................................................................................................... 71 Value......................................................................................................................................................................................... 71 Case.......................................................................................................................................................................................... 71 Case When................................................................................................................................................................................ 72 Cipher....................................................................................................................................................................................... 72 Select Expression........................................................................................................................................................................ 72 Data Type.................................................................................................................................................................................. 72 Name........................................................................................................................................................................................ 72 Alias.......................................................................................................................................................................................... 72 Quoted Name............................................................................................................................................................................. 73 String........................................................................................................................................................................................ 73 Int............................................................................................................................................................................................. 73 Long.......................................................................................................................................................................................... 73 Hex Number............................................................................................................................................................................... 73 Decimal..................................................................................................................................................................................... 73 Double....................................................................................................................................................................................... 74 5 of 129
  • 6. Date.......................................................................................................................................................................................... 74 Time.......................................................................................................................................................................................... 74 Timestamp................................................................................................................................................................................. 74 Boolean..................................................................................................................................................................................... 74 Bytes......................................................................................................................................................................................... 74 Null........................................................................................................................................................................................... 75 Hex........................................................................................................................................................................................... 75 Digit.......................................................................................................................................................................................... 75 Functions.............................................................................................................................................................................................. 76 Aggregate Functions......................................................................................................................................................................... 76 Numeric Functions............................................................................................................................................................................ 76 String Functions............................................................................................................................................................................... 76 Time and Date Functions.................................................................................................................................................................. 77 System Functions............................................................................................................................................................................. 77 AVG........................................................................................................................................................................................... 78 COUNT...................................................................................................................................................................................... 78 GROUP_CONCAT........................................................................................................................................................................ 78 MAX.......................................................................................................................................................................................... 78 MIN........................................................................................................................................................................................... 78 SUM.......................................................................................................................................................................................... 78 SELECTIVITY............................................................................................................................................................................. 79 STDDEV_POP............................................................................................................................................................................. 79 STDDEV_SAMP........................................................................................................................................................................... 79 VAR_POP................................................................................................................................................................................... 79 VAR_SAMP................................................................................................................................................................................. 79 ABS........................................................................................................................................................................................... 79 ACOS......................................................................................................................................................................................... 80 ASIN......................................................................................................................................................................................... 80 ATAN......................................................................................................................................................................................... 80 COS........................................................................................................................................................................................... 80 COT.......................................................................................................................................................................................... 80 SIN........................................................................................................................................................................................... 80 TAN........................................................................................................................................................................................... 81 ATAN2....................................................................................................................................................................................... 81 BITAND..................................................................................................................................................................................... 81 BITOR....................................................................................................................................................................................... 81 BITXOR..................................................................................................................................................................................... 81 MOD.......................................................................................................................................................................................... 81 CEILING.................................................................................................................................................................................... 82 DEGREES................................................................................................................................................................................... 82 EXP........................................................................................................................................................................................... 82 FLOOR....................................................................................................................................................................................... 82 LOG........................................................................................................................................................................................... 82 LOG10....................................................................................................................................................................................... 82 RADIANS................................................................................................................................................................................... 83 SQRT......................................................................................................................................................................................... 83 PI.............................................................................................................................................................................................. 83 POWER...................................................................................................................................................................................... 83 RAND........................................................................................................................................................................................ 83 RANDOM_UUID.......................................................................................................................................................................... 83 ROUND...................................................................................................................................................................................... 84 ROUNDMAGIC............................................................................................................................................................................ 84 SECURE_RAND........................................................................................................................................................................... 84 SIGN......................................................................................................................................................................................... 84 ENCRYPT................................................................................................................................................................................... 84 DECRYPT................................................................................................................................................................................... 84 HASH........................................................................................................................................................................................ 85 TRUNCATE................................................................................................................................................................................. 85 COMPRESS................................................................................................................................................................................. 85 EXPAND..................................................................................................................................................................................... 85 ZERO......................................................................................................................................................................................... 85 ASCII........................................................................................................................................................................................ 85 BIT_LENGTH.............................................................................................................................................................................. 86 LENGTH..................................................................................................................................................................................... 86 OCTET_LENGTH......................................................................................................................................................................... 86 CHAR........................................................................................................................................................................................ 86 CONCAT.................................................................................................................................................................................... 86 DIFFERENCE.............................................................................................................................................................................. 86 HEXTORAW................................................................................................................................................................................ 87 RAWTOHEX................................................................................................................................................................................ 87 INSTR....................................................................................................................................................................................... 87 INSERT Function........................................................................................................................................................................ 87 LOWER...................................................................................................................................................................................... 87 UPPER....................................................................................................................................................................................... 87 LEFT.......................................................................................................................................................................................... 88 RIGHT....................................................................................................................................................................................... 88 LOCATE..................................................................................................................................................................................... 88 POSITION.................................................................................................................................................................................. 88 6 of 129
  • 7. LTRIM....................................................................................................................................................................................... 88 RTRIM....................................................................................................................................................................................... 88 TRIM......................................................................................................................................................................................... 89 REPEAT..................................................................................................................................................................................... 89 REPLACE.................................................................................................................................................................................... 89 SOUNDEX.................................................................................................................................................................................. 89 SPACE....................................................................................................................................................................................... 89 STRINGDECODE......................................................................................................................................................................... 89 STRINGENCODE......................................................................................................................................................................... 90 STRINGTOUTF8.......................................................................................................................................................................... 90 SUBSTRING............................................................................................................................................................................... 90 UTF8TOSTRING.......................................................................................................................................................................... 90 XMLATTR................................................................................................................................................................................... 90 XMLNODE.................................................................................................................................................................................. 90 XMLCOMMENT........................................................................................................................................................................... 91 XMLCDATA................................................................................................................................................................................. 91 XMLSTARTDOC.......................................................................................................................................................................... 91 XMLTEXT................................................................................................................................................................................... 91 AUTOCOMMIT............................................................................................................................................................................ 91 CASEWHEN Function................................................................................................................................................................... 91 CAST......................................................................................................................................................................................... 92 COALESCE................................................................................................................................................................................. 92 CONVERT.................................................................................................................................................................................. 92 CURRVAL................................................................................................................................................................................... 92 CSVREAD................................................................................................................................................................................... 92 CSVWRITE................................................................................................................................................................................. 92 DATABASE................................................................................................................................................................................. 93 DATABASE_PATH....................................................................................................................................................................... 93 IDENTITY.................................................................................................................................................................................. 93 IFNULL...................................................................................................................................................................................... 93 LOCK_MODE.............................................................................................................................................................................. 93 LOCK_TIMEOUT......................................................................................................................................................................... 93 MEMORY_FREE.......................................................................................................................................................................... 94 MEMORY_USED.......................................................................................................................................................................... 94 NEXTVAL................................................................................................................................................................................... 94 NULLIF...................................................................................................................................................................................... 94 READONLY................................................................................................................................................................................. 94 ROWNUM................................................................................................................................................................................... 94 USER......................................................................................................................................................................................... 95 CURRENT_DATE......................................................................................................................................................................... 95 CURRENT_TIME......................................................................................................................................................................... 95 CURRENT_TIMESTAMP............................................................................................................................................................... 95 DATEADD.................................................................................................................................................................................. 95 DATEDIFF.................................................................................................................................................................................. 95 DAYNAME.................................................................................................................................................................................. 96 DAYOFMONTH........................................................................................................................................................................... 96 DAYOFWEEK.............................................................................................................................................................................. 96 DAYOFYEAR............................................................................................................................................................................... 96 EXTRACT................................................................................................................................................................................... 96 FORMATDATETIME..................................................................................................................................................................... 96 HOUR........................................................................................................................................................................................ 97 MINUTE..................................................................................................................................................................................... 97 MONTH...................................................................................................................................................................................... 97 MONTHNAME............................................................................................................................................................................. 97 PARSEDATETIME........................................................................................................................................................................ 97 QUARTER.................................................................................................................................................................................. 97 SECOND.................................................................................................................................................................................... 98 WEEK........................................................................................................................................................................................ 98 YEAR......................................................................................................................................................................................... 98 Data Types............................................................................................................................................................................................ 99 INT Type................................................................................................................................................................................... 99 BOOLEAN Type.......................................................................................................................................................................... 99 TINYINT Type............................................................................................................................................................................ 99 SMALLINT Type.......................................................................................................................................................................... 99 BIGINT Type............................................................................................................................................................................ 100 IDENTITY Type........................................................................................................................................................................ 100 DECIMAL Type......................................................................................................................................................................... 100 DOUBLE Type........................................................................................................................................................................... 100 REAL Type............................................................................................................................................................................... 100 TIME Type............................................................................................................................................................................... 100 DATE Type............................................................................................................................................................................... 101 TIMESTAMP Type..................................................................................................................................................................... 101 BINARY Type............................................................................................................................................................................ 101 OTHER Type............................................................................................................................................................................ 101 VARCHAR Type......................................................................................................................................................................... 101 VARCHAR_IGNORECASE Type.................................................................................................................................................... 102 BLOB Type............................................................................................................................................................................... 102 CLOB Type............................................................................................................................................................................... 102 7 of 129