H2 Documentation
Total Page:16
File Type:pdf, Size:1020Kb
H2 Database Engine Version 1.0.78 (2008-08-28) 1 of 143 Table of Contents H2 Database Engine.............................................................................................................................................................1 Quickstart .........................................................................................................................................................................11 Embedding H2 in an Application ....................................................................................................................................11 The H2 Console Application ..........................................................................................................................................11 Step-by-Step ..........................................................................................................................................................11 Installation ........................................................................................................................................................11 Start the Console ...............................................................................................................................................11 Login ................................................................................................................................................................12 Sample .............................................................................................................................................................13 Execute .............................................................................................................................................................14 Disconnect ........................................................................................................................................................15 End ..................................................................................................................................................................15 Installation ........................................................................................................................................................................16 Requirements ..............................................................................................................................................................16 Supported Platforms .....................................................................................................................................................16 Installing the Software .................................................................................................................................................16 Directory Structure .......................................................................................................................................................16 Tutorial .............................................................................................................................................................................17 Starting and Using the H2 Console ................................................................................................................................17 Firewall ..................................................................................................................................................................17 Native Version ........................................................................................................................................................18 Testing Java ...........................................................................................................................................................18 Error Message 'Port is in use' ...................................................................................................................................18 Using another Port ..................................................................................................................................................18 Starting Successfully ...............................................................................................................................................18 Connecting to the Server using a Browser ................................................................................................................18 Multiple Concurrent Sessions ...................................................................................................................................18 Application Properties .............................................................................................................................................18 Login .....................................................................................................................................................................19 Error Messages .......................................................................................................................................................19 Adding Database Drivers .........................................................................................................................................19 Using the Application ..............................................................................................................................................19 Inserting Table Names or Column Names .................................................................................................................19 Disconnecting and Stopping the Application ..............................................................................................................19 Connecting to a Database using JDBC ...........................................................................................................................19 Creating New Databases ...............................................................................................................................................20 Using the Server ..........................................................................................................................................................20 Starting the Server from Command Line ...................................................................................................................20 Connecting to the TCP Server ..................................................................................................................................20 Starting the Server within an Application ..................................................................................................................20 Stopping a TCP Server from Another Process ............................................................................................................21 Using Hibernate ...........................................................................................................................................................21 Using Databases in Web Applications ............................................................................................................................21 Embedded Mode .....................................................................................................................................................21 Server Mode ...........................................................................................................................................................21 Using a Servlet Listener to Start and Stop a Database ...............................................................................................21 CSV (Comma Separated Values) Support .......................................................................................................................22 Writing a CSV File from Within a Database ...............................................................................................................22 Reading a CSV File from Within a Database ..............................................................................................................22 Writing a CSV File from a Java Application ................................................................................................................22 Reading a CSV File from a Java Application ..............................................................................................................23 Upgrade, Backup, and Restore ......................................................................................................................................23 Database Upgrade ..................................................................................................................................................23 Backup using the Script Tool ...................................................................................................................................23 Restore from a Script ..............................................................................................................................................23 Online Backup ........................................................................................................................................................23 Command Line Tools ....................................................................................................................................................24 Using OpenOffice Base .................................................................................................................................................24