Hsqldb User Guide
The HSQLDB Development GroupEdited by Blaine Simpson and Fred
Toussi
Hsqldb User Guide
by The HSQLDB Development Group, Blaine Simpson, and Fred Toussi
Published $Date: 2007/08/28 12:13:28 $
Copyright 2002-2007 HSQLDB Development Group. Permission is granted to distribute this document without any alteration un-
der the terms of the HSQLDB license.
Table of Contents
Introduction .............................................................................................................. xi
Available formats for this document ...................................................................... xi
1. Running and Using Hsqldb ........................................................................................1
Introduction .......................................................................................................1
Running Tools ....................................................................................................1
Running Hsqldb ..................................................................................................2
Server Modes .....................................................................................................2
Hsqldb Server .............................................................................................3
Hsqldb Web Server .....................................................................................3
Hsqldb Servlet ............................................................................................3
In-Process (Standalone) Mode ....................................................................... 4
Memory-Only Databases ..............................................................................5
General ............................................................................................................. 5
Closing the Database ...................................................................................5
Using Multiple Databases in One JVM ............................................................5
Creating a New Database ..............................................................................6
Using the Database Engine ...................................................................................6
Different Types of Tables ............................................................................. 6
Constraints and Indexes ................................................................................7
SQL Support ..............................................................................................7
JDBC Support ............................................................................................ 8
2. SQL Issues .............................................................................................................9
Purpose .............................................................................................................9
SQL Standard Support .........................................................................................9
Constraints and Indexes ........................................................................................9
Primary Key Constraints ...............................................................................9
Unique Constraints .................................................................................... 10
Unique Indexes ......................................................................................... 10
FOREIGN KEYS ...................................................................................... 10
Indexes and Query Speed ............................................................................ 10
Where Condition or Join ............................................................................. 11
Subqueries and Joins .................................................................................. 12
Types and Arithmetic Operations ......................................................................... 12
Integral Types .......................................................................................... 13
Other Numeric Types ................................................................................. 13
Bit and Boolean Types ............................................................................... 14
Storage and Handling of Java Objects ........................................................... 14
Type Size, Precision and Scale .................................................................... 14
Sequences and Identity ....................................................................................... 15
Identity Auto-Increment Columns ................................................................ 15
Sequences ................................................................................................ 15
Issues with Transactions ..................................................................................... 16
New Features and Changes ................................................................................. 16
3. UNIX Quick Start .................................................................................................. 17
Purpose ........................................................................................................... 17
Installation ....................................................................................................... 17
Setting up Database Instance and Server ................................................................ 19
Accessing your Database .................................................................................... 20
Create additional Accounts ................................................................................. 23
Shutdown ........................................................................................................ 24
Running Hsqldb as a System Daemon ................................................................... 24
Portability of hsqldb init script ..................................................................... 24
Init script Setup Procedure .......................................................................... 24
iv
Troubleshooting the Init Script .................................................................... 28
4. Advanced Topics ................................................................................................... 30
Purpose ........................................................................................................... 30
Connections ..................................................................................................... 30
Connection properties ................................................................................ 31
Properties Files ................................................................................................. 32
Server and Web Server Properties ................................................................ 33
Starting a Server from your application ......................................................... 34
Individual Database Properties ..................................................................... 34
SQL Commands for Database Properties ............................................................... 37
5. Deployment Issues ................................................................................................. 39
Purpose ........................................................................................................... 39
Mode of Operation and Tables ............................................................................. 39
Mode of Operation .................................................................................... 39
Tables ..................................................................................................... 39
Large Objects ........................................................................................... 40
Deployment context ................................................................................... 40
Memory and Disk Use ....................................................................................... 40
Cache Memory Allocation .......................................................................... 41
Managing Database Connections .......................................................................... 42
Upgrading Databases ......................................................................................... 42
Upgrading Using the SCRIPT Command ....................................................... 43
Manual Changes to the .script File ................................................................ 43
Backing Up Databases ....................................................................................... 44
6. Text Tables ........................................................................................................... 45
The Implementation ........................................................................................... 45
Definition of Tables ................................................................................... 45
Scope and Reassignment ............................................................................ 46
Null Values in Columns of Text Tables ......................................................... 46
Configuration ........................................................................................... 46
Disconnecting Text Tables .......................................................................... 48
Text File Issues ................................................................................................. 48
Text File Global Properties ................................................................................. 49
Importing from a Text Table file .......................................................................... 49
7. TLS .................................................................................................................... 50
Requirements ................................................................................................... 50
Encrypting your JDBC connection ....................................................................... 50
Client-Side .............................................................................................. 50
Server-Side .............................................................................................. 52
JSSE ............................................................................................................... 52
Making a Private-key Keystore ............................................................................ 52
CA-Signed Cert ........................................................................................ 53
Non-CA-Signed Cert ................................................................................. 53
Automatic Server or WebServer startup on UNIX ................................................... 53
8. SqlTool ................................................................................................................ 54
Purpose, Coverage, Changes in Behavior ............................................................... 54
Platforms and SqlTool versions covered ........................................................ 55
Functional Changes ................................................................................... 55
The Bare Minimum ........................................................................................... 56
Non-displayable Types ............................................................................... 58
Desktop shortcuts ...................................................................................... 58
Loading sample data .................................................................................. 59
RC File Authentication Setup .............................................................................. 59
Using Inline RC Authentication ........................................................................... 63
Using the current version of SqlTool with an older HSQLDB distribution. ................... 63
Interactive Usage .............................................................................................. 64
Command Types ....................................................................................... 64
Command Types ............................................................................................... 65
Hsqldb User Guide
v
- 1
- 2
- 3
- 4
- 5
- 6
前往页