@advanced_1000_h1
進歩したトピックス
@advanced_1001_a
Result Sets
@advanced_1002_a
大きなオブジェクト
@advanced_1003_a
リンクテーブル
@advanced_1004_a
トランザクション分離
@advanced_1005_a
#Multi-Version Concurrency Control (MVCC)
@advanced_1006_a
クラスタリング / 高可用性
@advanced_1007_a
2フェーズコミット
@advanced_1008_a
互換性
@advanced_1009_a
#Standards Compliance
@advanced_1010_a
Windowsサービスとして実行する
@advanced_1011_a
ODBCドライバ
@advanced_1012_a
#Using H2 in Microsoft .NET
@advanced_1013_a
ACID
@advanced_1014_a
永続性問題
@advanced_1015_a
リカバーツールを使用する
@advanced_1016_a
ファイルロックプロトコル
@advanced_1017_a
SQLインジェクションに対する防御
@advanced_1018_a
#Restricting Class Loading and Usage
@advanced_1019_a
セキュリティプロトコル
@advanced_1020_a
SSL/TLS 接続
@advanced_1021_a
汎用一意識別子 (UUID)
@advanced_1022_a
システムプロパティから読み込まれた設定
@advanced_1023_a
#Setting the Server Bind Address
@advanced_1024_a
#Limitations
@advanced_1025_a
用語集とリンク
@advanced_1026_h2
Result Sets
@advanced_1027_h3
行数の制限
@advanced_1028_p
アプリケーションから結果が返される前に、全ての行はデータベースによって読み取られます。 サーバー側のカーソルは現在サポートされていません。もし最初の数行がアプリケーションに読み取られたら、 result setサイズはパフォーマンスを改善するために制限されます。これは、クエリーの LIMIT を使用することで 実現できます (例: SELECT * FROM TEST LIMIT 100)、または Statement.setMaxRows(max) を使用します。
@advanced_1029_h3
大きなResult Set と外部ソート
@advanced_1030_p
#For large result set, the result is buffered to disk. The threshold can be defined using the statement SET MAX_MEMORY_ROWS. If ORDER BY is used, the sorting is done using an external sort algorithm. In this case, each block of rows is sorted using quick sort, then written to disk; when reading the data, the blocks are merged together.
@advanced_1031_h2
大きなオブジェクト
@advanced_1032_h3
大きなオブジェクトのソートと読み込み
@advanced_1033_p
メモリに収まらないオブジェクトは可能であるなら、 データ型は CLOB (テキストデータ) または BLOB (バイナリーデータ) が使用されるべきです。 これらのデータ型に関して、オブジェクトはストリームを使用して、完全にメモリから読み込まれるというわけではありません。 BLOB を保存するためには、PreparedStatement.setBinaryStream を使用します。 CLOB を使用するためには、PreparedStatement.setCharacterStream を使用します。 BLOB を読み込みためには、ResultSet.getBinaryStream を使用し、CLOB を読み込むために ResultSet.getCharacterStream を使用します。もし クライアント / サーバーモードが使用されていたら、 BLOB と CLOB データはアクセス時に完全にメモリから読み込まれます。このケースでは、メモリによって BLOB と CLOB のサイズは制限されています。
@advanced_1034_h2
リンクテーブル
@advanced_1035_p
このデータベースはリンクテーブルをサポートしています。これは、 現在存在しないテーブルは、ただ他のデータベースへリンクするという意味です。 このようなリンクを作るには、CREATE LINKED TABLE ステートメントを使用します:
@advanced_1036_p
#You can then access the table in the usual way. Whenever the linked table is accessed, the database issues specific queries over JDBC. Using the example above, if you issue the query SELECT * FROM LINK WHERE ID=1
, then the following query is run against the PostgreSQL database: SELECT * FROM TEST WHERE ID=?
. The same happens for insert and update statements. Only simple statements are executed against the target database, that means no joins. Prepared statements are used where possible.
@advanced_1037_p
#To view the statements that are executed against the target table, set the trace level to 3.
@advanced_1038_p
#There is a restriction when inserting data to this table: When inserting or updating rows into the table, NULL and values that are not set in the insert statement are both inserted as NULL. This may not have the desired effect if a default value in the target table is other than NULL.
@advanced_1039_p
#If multiple linked tables point to the same database (using the same database URL), the connection is shared. To disable this, set the system property h2.shareLinkedConnections to false.
@advanced_1040_p
#The CREATE LINKED TABLE statement supports an optional schema name parameter. See the grammar for details.
@advanced_1041_h2
トランザクション分離
@advanced_1042_p
このデータベースは次のトランザクション分離レベルをサポートしています:
@advanced_1043_b
Read Committed (コミット済み読み取り)
@advanced_1044_li
これはデフォルトレベルです。
read lockは早急に解除されます。 このレベルを使用する時、高い同時並行性が可能です。
これは多数のデータベースシステムで使用される分離レベルです。
@advanced_1045_li
これを有効にするには、 SQLステートメント 'SET LOCK_MODE 3' を実行します。
@advanced_1046_li
または、;LOCK_MODE=3 をデータベースURLに付け加えます: jdbc:h2:~/test;LOCK_MODE=3
@advanced_1047_b
Serializable (直列化)
@advanced_1048_li
これを有効にするには、 SQLステートメント 'SET LOCK_MODE 1' を実行します。
@advanced_1049_li
または、;LOCK_MODE=1 をデータベースURLに付け加えます: jdbc:h2:~/test;LOCK_MODE=1
@advanced_1050_b
Read Uncommitted (非コミット読み取り)
@advanced_1051_li
このレベルの意味は、トランザクション分離は無効だということです。
@advanced_1052_li
これを有効にするには、SQLステートメント 'SET LOCK_MODE 0' を実行します
@advanced_1053_li
または、;LOCK_MODE=0 をデータベースURLに付け加えます: jdbc:h2:~/test;LOCK_MODE=0
@advanced_1054_p
分離レベル "serializable" を使用している時、ダーティリード、反復不可能読み取り、 ファントムリードを防ぐことができます。
@advanced_1055_b
Dirty Reads (ダーティリード)
@advanced_1056_li
他の接続によるコミットされていない変更を読み取ることができる、という意味です。
@advanced_1057_li
実行可能: read uncommitted (非コミット読み取り)
@advanced_1058_b
Non-Repeatable Reads (反復不可能読み取り)
@advanced_1059_li
ひとつの接続が行を読み取り、 他の接続が行を変更し、コミットすると、最初の接続は同じ行を再読し、新しい結果を取得します。
@advanced_1060_li
実行可能: read uncommitted (非コミット読み取り)、read committed (コミット済み読み取り)
@advanced_1061_b
Phantom Reads (ファントムリード)
@advanced_1062_li
ひとつの接続が条件を使って行の集まりを読み取り、 他の接続がこの条件を壊して行を挿入し、コミットした時、最初の接続は同じ条件を使って再読し、 新しい行を取得します。
@advanced_1063_li
実行可能: read uncommitted (非コミット読み取り)、read committed (コミット済み読み取り)
@advanced_1064_h3
テーブルレベルロック
@advanced_1065_p
#The database allows multiple concurrent connections to the same database. To make sure all connections only see consistent data, table level locking is used by default. This mechanism does not allow high concurrency, but is very fast. Shared locks and exclusive locks are supported. Before reading from a table, the database tries to add a shared lock to the table (this is only possible if there is no exclusive lock on the object by another connection). If the shared lock is added successfully, the table can be read. It is allowed that other connections also have a shared lock on the same object. If a connection wants to write to a table (update or delete a row), an exclusive lock is required. To get the exclusive lock, other connection must not have any locks on the object. After the connection commits, all locks are released. This database keeps all locks in memory.
@advanced_1066_h3
ロックタイムアウト
@advanced_1067_p
もし接続がオブジェクト上でロックを取得できないのであれば、一定時間待機します (ロックタイムアウト)。この時間の間、うまくいけば接続はロックコミットを保有し、 この時、ロックを取得することが可能です。他の接続がロックを解除しないため、 これが不可能であれば、失敗した接続がロックタイムアウト例外を取得します。 それぞれの接続に個別にロックタイムアウトを設定することができます。
@advanced_1068_h2
#Multi-Version Concurrency Control (MVCC)
@advanced_1069_p
#The MVCC feature allows higher concurrency than using (table level or row level) locks. When using MVCC in this database, delete, insert and update operations will only issue a shared lock on the table. An exclusive lock is still used when adding or removing columns, when dropping the table, and when using SELECT ... FOR UPDATE. Connections only 'see' committed data, and own changes. That means, if connection A updates a row but doesn't commit this change yet, connection B will see the old value. Only when the change is committed, the new value is visible by other connections (read committed). If multiple connections concurrently try to update the same row, this database fails fast: a concurrent update exception is thrown.
@advanced_1070_p
#To use the MVCC feature, append MVCC=TRUE to the database URL:
@advanced_1071_p
#MVCC can not be used at the same time as MULTI_THREADED. The MVCC feature is not fully tested yet.
@advanced_1072_h2
クラスタリング / 高可用性
@advanced_1073_p
このデータベースは簡単なクラスタリング / 高可用性メカニズムをサポートしています。 アーキテクチャ: 二つのデータベースサーバーは二つの異なったコンピューター上で動作し、 両方のコンピューターは同じデータベースのコピーです。もし両方のサーバーが動いたら、 それぞれのデータベース操作は両方のコンピューター上で実行されます。ひとつのサーバーがおちたら (電源、ハードウェア、またはネットワーク障害)、他のサーバーはまだ動作を続行します。 このポイントから、操作は他のサーバーがバックアップされるまで、ひとつのサーバー上で実行されます。
@advanced_1074_p
クラスタリングはサーバーモードでのみ使用できます (エンベッドモードはクラスタリングをサポートしていません)。 サーバーを停止しないでクラスタを回復することは可能ですが、二番目のデータベースが回復している間に、 他のどんなアプリケーションでも最初のデータベースのデータを変更しないことは重要なため、 クラスタを回復するのは現在手動プロセスです。
@advanced_1075_p
クラスタを初期化するには、次の手順に従います:
@advanced_1076_li
データベースを作成する
@advanced_1077_li
他の位置にデータベースをコピーし、クラスタリングを初期化するために、 CreateClusterツールを使用します。その後、同じデータが含まれる二つのデータベースを所有します。
@advanced_1078_li
二つのサーバーを起動します (ひとつはそれぞれのデータベースのコピー)
@advanced_1079_li
これでクライアントアプリケーションのデータベースに接続する準備ができました
@advanced_1080_h3
CreateClusterツールを使用する
@advanced_1081_p
クラスタリングがどのように機能するか理解するために、 次の例を試してみて下さい。この例では、二つのデータベースは同じコンピューター内に属していますが、 通常は、データベースは異なるサーバー内にあります。
@advanced_1082_li
二つのディレクトリを作成します: server1 と server2 です。それぞれのディレクトリは コンピューター上のディレクトリをシミュレートします。
@advanced_1083_li
最初のディレクトリを示してTCPサーバーを起動します。 次のコマンドラインを使用して実行できます:
@advanced_1084_li
二番目のディレクトリを示して二番目のTCPサーバーを起動します。 これは二番目の (重複の) コンピューターで動いているサーバーをシミュレートします。 次のコマンドラインを使用して実行できます:
@advanced_1085_li
クラスタリングを初期化するためにCreateClusterツールを使用します。 データベースが存在しなければ、自動的に新しい、空のデータベースを作成します。 次のコマンドラインでツールを実行します:
@advanced_1086_li
#You can now connect to the databases using an application or the H2 Console using the JDBC URL jdbc:h2:tcp://localhost:9101,localhost:9102/~/test
@advanced_1087_li
サーバーを止めたら (プロセスを無視して)、他のマシンは動作を続行し、 従ってデータベースもまだアクセス可能だということがわかります。
@advanced_1088_li
クラスタを回復するために、まず最初に失敗したデータベースを削除し、止められていたサーバーを 再起動します。そして、CreateClusterツールを再実行します。
@advanced_1089_h3
クラスタリングアルゴリズムと制限
@advanced_1090_p
読み取り専用クエリーは、最初のクラスタノードに対してのみ 実行されますが、他の全てのステートメントは全てのノードに対して実行されます。 現在、トランザクションの問題を回避するように作られたロードバランシングは存在しません。 次の関数は、異なったクラスタノード上で異なった結果をもたらすので、実行には注意して下さい: RANDOM_UUID()、SECURE_RAND()、SESSION_ID()、MEMORY_FREE()、 MEMORY_USED()、CSVREAD()、CSVWRITE()、RAND() [seed を使用していない時] 直接ステートメントを変更する際に、これらの関数を使用してはなりません (例: INSERT、 UPDATE、または MERGE)。しかし、読み取り専用ステートメントでは使用でき、 結果はステートメントを変更するために使用することができます。
@advanced_1091_h2
2フェーズコミット
@advanced_1092_p
2フェーズコミットプロトコルがサポートされています。 2フェーズコミットは次のように機能します:
@advanced_1093_li
オートコミットはOFFの状態であることが必要です
@advanced_1094_li
トランザクションは、例えば行を挿入することによって、起動されます
@advanced_1095_li
トランザクションは、SQLステートメント PREPARE COMMIT transactionName を実行することによって "prepared" とマークされます
@advanced_1096_li
現在トランザクションはコミット、またはロールバックすることができます
@advanced_1097_li
トランザクションがコミット、またはロールバックに成功する前に問題が起きたら (例えば、ネットワークの問題が起きたことによって)、トランザクションは "in-doubt" の状態になります
@advanced_1098_li
データベースへの再接続時、in-doubtトランザクションは SELECT * FROM INFORMATION_SCHEMA.IN_DOUBT でリストアップされます
@advanced_1099_li
リスト上のそれぞれのトランザクションは、COMMIT TRANSACTION transactionName または、 ROLLBACK TRANSACTION transactionName を実行してコミット、またはロールバックされなければなりません
@advanced_1100_li
変更を適用するために、データベースを終了し、再び開く必要があります
@advanced_1101_h2
互換性
@advanced_1102_p
このデータベースは (ある程度までは)、HSQLDB、MySQL や PostgreSQLのような 他のデータベースと互換性があります。H2が互換性のないある一定の領域があります。
@advanced_1103_h3
オートコミットがONの時のトランザクションコミット
@advanced_1104_p
この時、このデータベースエンジンは 結果が返ってくる直前にトランザクションをコミットします (オートコミットがONの場合)。 クエリーにとって、アプリケーションがresult setを通してスキャンする前や、result setが閉じられる前でさえも、 トランザクションはコミットされるということを意味しています。このケースでは、他のデータベースエンジンは result setが閉じられる時、トランザクションをコミットします。
@advanced_1105_h3
キーワード / 予約語
@advanced_1106_p
引用 (二重引用符で囲まれる) されない限り、識別子 (テーブル名、カラム名など) として使用できないキーワードのリストがあります。 現在のリスト:
@advanced_1107_p
#CROSS, CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP, DISTINCT, EXCEPT, EXISTS, FALSE, FOR, FROM, FULL, GROUP, HAVING, INNER, INTERSECT, IS, JOIN, LIKE, LIMIT, MINUS, NATURAL, NOT, NULL, ON, ORDER, PRIMARY, ROWNUM, SELECT, SYSDATE, SYSTIME, SYSTIMESTAMP, TODAY, TRUE, UNION, WHERE
@advanced_1108_p
このリストのある特定のワードはキーワードです。なぜなら、例えば CURRENT_TIMESTAMP のような 互換性のため "()" なしで使用できる関数だからです。
@advanced_1109_h2
#Standards Compliance
@advanced_1110_p
#This database tries to be as much standard compliant as possible. For the SQL language, ANSI/ISO is the main standard. There are several versions that refer to the release date: SQL-92, SQL:1999, and SQL:2003. Unfortunately, the standard documentation is not freely available. Another problem is that important features are not standardized. Whenever this is the case, this database tries to be compatible to other databases.
@advanced_1111_h2
Windowsサービスとして実行する
@advanced_1112_p
ネイティブラッパー / アダプタを使用して、JavaアプリケーションはWindowsサービスとして実行できます。これを実行するために、様々なツールが有効です。Tanuki Software, Inc. (http://wrapper.tanukisoftware.org/) のJavaサービスラッパーはインストールが含まれています。H2データベースエンジンサービスのインストール、起動、終了とアンインストールのためのバッチファイルが添付されます。このサービスは、TCPサーバーとH2コンソールWebアプリケーションが含まれます。バッチファイルは、H2/service ディレクトリに配置されています。
@advanced_1113_h3
サービスをインストールする
@advanced_1114_p
サービスは、最初にWindowsサービスとして登録することが必要です。 これを行うために、1_install_service.bat をダブルクリックします。 成功すれば、コマンドプロンプトウィンドウが開き、すぐに消えます。失敗したらメッセージが現れます。
@advanced_1115_h3
サービスを起動する
@advanced_1116_p
Windowsのサービスマネージャを使用するか、2_start_service.bat をダブルクリックして H2データベースエンジンサービスを起動することができます。サービスがインストールされていなければ、 バッチファイルはエラーメッセージを表示しないということに注意して下さい。
@advanced_1117_h3
H2コンソールに接続する
@advanced_1118_p
サービスのインストールと起動後、ブラウザを使用してH2コンソールアプリケーションに 接続することができます。3_start_browser.bat をダブルクリックして実行します。 デフォルトのポート (8082) はバッチファイルでハードコード化されているものです。
@advanced_1119_h3
サービスを終了する
@advanced_1120_p
サービスを終了するには、4_stop_service.bat をダブルクリックします。 サービスがインストール、または開始されていなければ、 バッチファイルはエラーメッセージを表示しないということに注意して下さい。
@advanced_1121_h3
サービスのアンインストール
@advanced_1122_p
サービスをアンインストールするには、5_uninstall_service.bat をダブルクリックします。成功すれば、コマンドプロンプトウィンドウが開き、すぐに消えます。 失敗したらメッセージが現れます。
@advanced_1123_h2
ODBCドライバ
@advanced_1124_p
このデータベースは現時点で、自身のODBCドライバと共に動作しませんが、PostgreSQLネットワークプロトコルをサポートしています。そのため、PostgreSQL ODBCドライバが使用可能です。PostgreSQLネットワークプロトコルのサポートは非常に新しく、試験的なものとして見なされます。製品アプリケーションで使用されるべきではありません。
@advanced_1125_p
#To use the PostgreSQL ODBC driver on 64 bit versions of Windows, first run c:/windows/syswow64/odbcad32.exe
. At this point you set up your DSN just like you would on any other system. See also: Re: ODBC Driver on Windows 64 bit
@advanced_1126_h3
ODBCインストール
@advanced_1127_p
#First, the ODBC driver must be installed. Any recent PostgreSQL ODBC driver should work, however version 8.2 (psqlodbc-08_02*) or newer is recommended. The Windows version of the PostgreSQL ODBC driver is available at http://www.postgresql.org/ftp/odbc/versions/msi .
@advanced_1128_h3
サーバーの起動
@advanced_1129_p
ODBCドライバのインストール後、コマンドラインを使用してH2サーバーを起動します:
@advanced_1130_p
PGサーバー (PostgreSQLプロトコルのためのPG) が同様に起動します。デフォルトでは、データベースはサーバーが起動した現在作業中のディレクトリに保存されます。ユーザーホームディレクトリなど、別のディレクトリにデータベースを保存するには、-baseDir を使用します:
@advanced_1131_p
PGサーバーは次のJavaアプリケーション内から起動、終了することが可能です:
@advanced_1132_p
デフォルトでは、ローカルホストからの接続のみ許可されます。リモート接続を許可するには、サーバーの起動時に-pgAllowOthers true
を使用します。
@advanced_1133_h3
ODBC設定
@advanced_1134_p
ドライバのインストール後、新しいデータソースを追加しなければなりません。Windowsでは、データソースAdministratorを開くために、odbcad32.exe
を実行します。"Add..." をクリックし、PostgreSQL Unicode driverを選択します。そして、"Finish" をクリックします。接続プロパティを変更することが可能です:
@advanced_1135_th
プロパティ
@advanced_1136_th
例
@advanced_1137_th
コメント
@advanced_1138_td
Data Source
@advanced_1139_td
H2 Test
@advanced_1140_td
ODBCデータソースの名称
@advanced_1141_td
Database
@advanced_1142_td
test
@advanced_1143_td
データベース名。現時点では簡易な名前のみサポートされています;
@advanced_1144_td
相対パス、または絶対パスはデータベース名にサポートされていません。
@advanced_1145_td
デフォルトでは、-baseDir 設定が使用された時を除き、
@advanced_1146_td
データベースはサーバーが起動された現在作業中のディレクトリに保存されます。
@advanced_1147_td
名前は少なくとも3文字でなければなりません。
@advanced_1148_td
Server
@advanced_1149_td
localhost
@advanced_1150_td
サーバー名、またはIPアドレス
@advanced_1151_td
デフォルトでは、リモート接続のみ許可されています。
@advanced_1152_td
User Name
@advanced_1153_td
sa
@advanced_1154_td
データベースのユーザー名
@advanced_1155_td
SSL Mode
@advanced_1156_td
disabled
@advanced_1157_td
現時点で、SSLはサポートされていません。
@advanced_1158_td
Port
@advanced_1159_td
5435
@advanced_1160_td
PGサーバーが傾聴しているポート
@advanced_1161_td
Password
@advanced_1162_td
sa
@advanced_1163_td
データベースパスワード
@advanced_1164_p
#To improve performance, please enable 'server side prepare' under Options / Datasource / Page 2 / Server side prepare.
@advanced_1165_p
この後、このデータソースを使用できます。
@advanced_1166_h3
PGプロトコルサポートの制限
@advanced_1167_p
現時点では、PostgreSQLネットワークプロトコルのサブセットのみ実装されています。また、カタログ、またはテキストエンコーディングでのSQLレベル上の互換性問題がある可能性があります。問題は発見されたら修正されます。現在、PGプロトコルが使用されている時、ステートメントはキャンセルされません。
@advanced_1168_p
#PostgreSQL ODBC Driver Setup requires a database password; that means it is not possible to connect to H2 databases without password. This is a limitation of the ODBC driver.
@advanced_1169_h3
セキュリティ考慮
@advanced_1170_p
現在、PGサーバーはchallenge response、またはパスワードの暗号化をサポートしていません。パスワードが読みやすいため、アタッカーがODBCドライバとサーバー間でのデータ転送を傾聴できる場合、これは問題になるでしょう。また、暗号化SSL接続も現在使用不可能です。そのため、ODBCドライバはセキュリティが重視される場面においては使用されるべきではありません。
@advanced_1171_h2
#Using H2 in Microsoft .NET
@advanced_1172_p
#The database can be used from Microsoft .NET even without using Java, by using IKVM.NET. You can access a H2 database on .NET using the JDBC API, or using the ADO.NET interface.
@advanced_1173_h3
#Using the ADO.NET API on .NET
@advanced_1174_p
#An implementation of the ADO.NET interface is available in the open source project H2Sharp .
@advanced_1175_h3
#Using the JDBC API on .NET
@advanced_1176_li
#Install the .NET Framework from Microsoft . Mono has not yet been tested.
@advanced_1177_li
#Install IKVM.NET .
@advanced_1178_li
#Copy the h2*.jar file to ikvm/bin
@advanced_1179_li
#Run the H2 Console using: ikvm -jar h2*.jar
@advanced_1180_li
#Convert the H2 Console to an .exe file using: ikvmc -target:winexe h2*.jar
. You may ignore the warnings.
@advanced_1181_li
#Create a .dll file using (change the version accordingly): ikvmc.exe -target:library -version:1.0.69.0 h2*.jar
@advanced_1182_p
#If you want your C# application use H2, you need to add the h2.dll and the IKVM.OpenJDK.ClassLibrary.dll to your C# solution. Here some sample code:
@advanced_1183_h2
ACID
@advanced_1184_p
データベースの世界では、ACIDとは以下を表しています:
@advanced_1185_li
Atomicity (原子性) : トランザクションはアトミックでなければならず、全てのタスクが実行されたか、実行されないかの どちらかであるという意味です。
@advanced_1186_li
Consistency (一貫性) : 全てのオペレーションは定義された制約に従わなくてはいけません。
@advanced_1187_li
Isolation (独立性 / 分離性) : トランザクションはそれぞれ独立 (隔離) されていなくてはなりません。
@advanced_1188_li
Durability (永続性) : コミットされたトランザクションは失われません。
@advanced_1189_h3
Atomicity (原子性)
@advanced_1190_p
このデータベースでのトランザクションは常にアトミックです。
@advanced_1191_h3
Consistency (一貫性)
@advanced_1192_p
このデータベースは常に一貫性のある状態です。 参照整合性のルールは常に実行されます。
@advanced_1193_h3
Isolation (独立性 / 分離性)
@advanced_1194_p
H2は、他の多くのデータベースシステムと同様に、デフォルトの分離レベルは "read committed" です。これはより良いパフォーマンスを提供しますが、トランザクションは完全に分離されていないということも意味します。H2はトランザクション分離レベル "serializable"、"read committed"、"read uncommitted" をサポートしています。
@advanced_1195_h3
Durability (永続性)
@advanced_1196_p
このデータベースは、全てのコミットされたトランザクションが電源異常に耐えられるということを保証しません。全てのデータベースが電源異常の状況において、一部トランザクションが失われるということをテストは示しています (詳細は下記をご覧下さい)。トランザクションが失われることを容認できない場面では、ノートパソコン、またはUPS (無停電電源装置) を使用します。永続性がハードウェア異常の起こり得る全ての可能性に対して必要とされるのであれば、H2クラスタリングモードのようなクラスタリングが使用されるべきです。
@advanced_1197_h2
永続性問題
@advanced_1198_p
完全な永続性とは、全てのコミットされたトランザクションは電源異常に耐えられる、ということを意味します。 いくつかのデータベースは、永続性を保証すると主張していますが、このような主張は誤っています。 永続性テストはH2、HSQLDB、PostgreSQL、Derbyに対して実行されました。これらの全てのデータベースは、 時々コミットされたトランザクションを失います。このテストはH2ダウンロードに含まれています。 org.h2.test.poweroff.Test をご覧下さい。
@advanced_1199_h3
永続性を実現する (しない) 方法
@advanced_1200_p
失われなかったコミット済みトランザクションは、最初に思うよりもより複雑だということを理解して下さい。 完全な永続性を保障するためには、データベースは、コミットの呼び出しが返ってくる前に ログレコードがハードドライブ上にあることを確実にしなければなりません。 これを行うために、データベースは異なったメソッドを使用します。ひとつは "同期書き込み" ファイルアクセスモードを使用することです。Javaでは、RandomAccessFile はモード "rws" と "rwd" を サポートしています:
@advanced_1201_li
rwd: それぞれのファイル内容の更新は、元になるストレージデバイスと同時に書き込まれます。
@advanced_1202_li
rws: rwdに加えて、それぞれのメタデータの更新は同時に書き込まれます。
@advanced_1203_p
この特徴はDerbyで使用されています。それらのモードのうちのひとつは、テスト (org.h2.test.poweroff.TestWrite) において、毎秒およそ5万件の書き込み操作を実現します。オペレーティングシステムのライトバッファーが無効の時でさえも、 書き込み速度は毎秒およそ5万件です。この特徴はディスクを交換させるというものではありません。 なぜなら、全てのバッファーをフラッシュするのではないからです。テストはファイル内の同じバイトを何度も更新しました。 もしハードドライブがこの速度での書き込みが可能なら、ディスクは少なくても毎秒5万回転か、 または300万 RPM (revolutions per minute 回転毎分) を行う必要があります。 そのようなハードドライブは存在しません。テストで使用されたハードドライブは、およそ7200 RPM、または 毎秒120回転です。これがオーバーヘッドなので、最大書き込み速度はこれより低くなくてはなりません。
@advanced_1204_p
バッファーは fsync 関数を呼ぶことによってフラッシュされます。Javaでこれを行う二つの方法があります:
@advanced_1205_li
FileDescriptor.sync() ドキュメンテーションには、これは強制的に全てのシステムバッファーに基本となる デバイスとの同期を取らせる、と書かれています。このFileDescriptorに関連するバッファーのインメモリでの 変更コピーが全て物理メディアに書かれた後、Syncは返ることになっています。
@advanced_1206_li
FileChannel.force() (JDK 1.4 以来) このメソッドは、強制的にこのチャネルのファイルの更新は それを含むストレージデバイスに書き込まれることを行います。
@advanced_1207_p
#By default, MySQL calls fsync for each commit. When using one of those methods, only around 60 write operations per second can be achieved, which is consistent with the RPM rate of the hard drive used. Unfortunately, even when calling FileDescriptor.sync() or FileChannel.force(), data is not always persisted to the hard drive, because most hard drives do not obey fsync(): see Your Hard Drive Lies to You . In Mac OS X, fsync does not flush hard drive buffers. See Bad fsync? . So the situation is confusing, and tests prove there is a problem.
@advanced_1208_p
ハードドライブバッファーを懸命にフラッシュしようと試みると、パフォーマンスは非常に悪いものになります。 最初に、ハードドライブは実際には全てのバッファーをフラッシュしているということを確かめることが必要です。 テストは信頼性ある方法でこれが行われていないことを示しています。その結果、トランザクションの最大数は毎秒およそ60件です。 これらの理由により、H2のデフォルト性質はコミットされたトランザクションの書き込みを遅らせることです。
@advanced_1209_p
H2では、電源異常の後、1秒以上のコミットされたトランザクションが失われます。 この性質を変更するためには。 SET WRITE_DELAY と CHECKPOINT SYNC を使用します。 多くの他のデータベースも同様に遅延コミットをサポートしています。パフォーマンス比較では、 遅延コミットは、サポートする全てのデータベースによって使用されました。
@advanced_1210_h3
永続性テストを実行する
@advanced_1211_p
このデータベースと他のデータベースの、永続性 / 非永続性テストを行うために、 パッケージ内 org.h2.test.poweroff のテストアプリケーションを使用することができます。 ネットワーク接続の二つのコンピューターがこのテストを実行するのに必要です。 ひとつのコンピューターは、他のコンピューター上でテストアプリケーションが実行されている間 (電源は切られています) ただ聞いています。リスナーアプリケーションのコンピューターは TCP/IP ポートを開き、 次の接続のために聞きます。二つ目のコンピューターは最初リスナーに接続し、データベースを作成して レコードの挿入を開始します。この接続は "autocommit" に設定されます。それぞれのレコード挿入後のコミットが 自動的に行われるという意味です。その後、テストコンピューターはこのレコードの挿入に成功したということを リスナーに通知します。リスナーコンピューターは10秒ごとに最後に挿入されたレコードを表示します。 電源を手動でOFFにしてコンピューターを再起動し、アプリケーションを再び実行します。 多くのケースで、リスナーコンピューターが知る全てのレコードを含むデータベースはないということがわかります。 詳細は、リスナーのソースコードとテストアプリケーションを参照して下さい。
@advanced_1212_h2
リカバーツールを使用する
@advanced_1213_p
#The recover tool can be used to extract the contents of a data file, even if the database is corrupted. It also extracts the content of the log file or large objects (CLOB or BLOB). To run the tool, type on the command line:
@advanced_1214_p
#For each database in the current directory, a text file will be created. This file contains raw insert statement (for the data) and data definition (DDL) statement to recreate the schema of the database. This file can be executed using the RunScript tool or a RUNSCRIPT FROM
SQL statement. The script include at least one CREATE USER statement. If you run the script against a database that was created with the same user, or if there are conflicting users, running the script will fail. Consider running the script against a database that was created with a user name that is not in the script.
@advanced_1215_h2
ファイルロックプロトコル
@advanced_1216_p
データベースが開かれるときはいつも、データベースが使用中であると他のプロセスに合図するためにロックファイルが作成されます。もしデータベースが閉じられるか、データベースを開いたプロセスが終了するなら、ロックファイルは削除されます。
@advanced_1217_p
#In special cases (if the process did not terminate normally, for example because there was a power failure), the lock file is not deleted by the process that created it. That means the existence of the lock file is not a safe protocol for file locking. However, this software uses a challenge-response protocol to protect the database files. There are two methods (algorithms) implemented to provide both security (that is, the same database files cannot be opened by two processes at the same time) and simplicity (that is, the lock file does not need to be deleted manually by the user). The two methods are 'file method' and 'socket methods'.
@advanced_1218_h3
ファイルロックメソッド "File"
@advanced_1219_p
データベースファイルロックのデフォルトメソッドは "Fileメソッド" です。アルゴリズム:
@advanced_1220_li
ロックファイルが存在しない時は、作成されます (アトミックオペレーション File.createNewFile を使用する)。 その時、プロセスは少し (20ms) 待機し、再びファイルをチェックします。 もしファイルがこの間に変更されたら、オペレーションは中止されます。 ロックファイルを作成したすぐ後にプロセスがロックファイルを削除する時、 これはレースコンディションから保護し、三番目のプロセスはファイルを再び作成します。 二つのライターしか存在しなければ、これは起こりません。
@advanced_1221_li
もしファイルが作成されたら、ロックメソッド ("file") でランダムな番号が一緒に挿入されます。 その後、ファイルが他のスレッド/ プロセスによって削除、または 修正された時、定期的にチェックする (デフォルトでは毎秒1回) watchdogスレッドは開始されます。 これが起きる時はいつも、ファイルは古いデータに上書きされます。システムが非常に混み合っている時でさえも、 非検出の状態で処理できないロックファイルを変更するために、watchdogスレッドは最優先に実行します。 しかし、watchdogスレッドはほとんどの時間待機しているため、非常に小さなリソース (CPU time) を使用します。 また、watchdogはハードディスクから読み取りのみ行い、書き込みはしません。
@advanced_1222_li
もしロックファイルが存在し、20ms内に変更されたら、プロセスは数回 (10回以上) 待機します。 まだ変更されていたら、例外が投げられます (データベースはロックされます)。 多数の並列ライターで競合している状態を排除するためにこれが行われます。 その後、ファイルは新しいバージョンに上書きされます。 そして、スレッドは2秒間待機します。もしファイルを保護するwatchdogスレッドが存在したら、 変更は上書きし、このプロセスはデータベースをロックするために機能しなくなります。 しかし、もしwatchdogスレッドが存在しなければ、ロックファイルはこのスレッドによって 書かれたままの状態です。このケースでは、ファイルは削除され、自動的にまた作成されます。 watchdogスレッドはこのケースでは起動され、ファイルはロックされます。
@advanced_1223_p
このアルゴリズムは100以上の並列スレッドでテストされました。いくつかのケースでは、 データベースをロックしようとする多数の並列スレッドが存在する時、それらはしばらくお互いをブロックします (それらのうちどれかがファイルをロックすることができないことを意味します)。 しかし、ファイルは同時に二つのスレッドによってロックされることは決してありません。 しかし、多数の並列スレッド / プロセスを使用することは一般的な使用ケースではありません。 通常、データベースを開くことができなかったり、(速い)ループのやり直しができなかったりした場合、 アプリケーションはユーザーにエラーを投げるべきです。
@advanced_1224_h3
ファイルロックメソッド "Socket"
@advanced_1225_p
#There is a second locking mechanism implemented, but disabled by default. To use it, append ;FILE_LOCK=SOCKET
to the database URL. The algorithm is:
@advanced_1226_li
ロックファイルが存在しない時は、作成されます。その時、サーバーソケットは定義されたポートで開かれ、 開かれた状態を保ちます。開かれたデータベースのプロセスのポートとIPアドレスはロックファイルの中に書かれています。
@advanced_1227_li
もしロックファイルが存在し、ロックメソッドが "file" なら、ソフトウェアは "file" メソッドにスイッチします。
@advanced_1228_li
#If the lock file exists, and the lock method is 'socket', then the process checks if the port is in use. If the original process is still running, the port is in use and this process throws an exception (database is in use). If the original process died (for example due to a power failure, or abnormal termination of the virtual machine), then the port was released. The new process deletes the lock file and starts again.
@advanced_1229_p
このメソッドは、活発に毎秒同じファイルをポーリングする (読み込む) watchdogスレッドを必要としていません。 このメソッドの問題は、ファイルがネットワークシェアに保存されたら、二つのプロセスは (異なるコンピューターで実行中の)、 TCP/IP接続を直接保持していなければ、同じデータベースファイルを開くことができます。
@advanced_1230_h2
SQLインジェクションに対する防御
@advanced_1231_h3
SQLインジェクションとは
@advanced_1232_p
このデータベースエンジンは "SQLインジェクション" として知られる セキュリティ脆弱性の解決策を備えています。 これは、SQLインジェクションの意味とは何か、 についての短い説明です。いくつかのアプリケーションは、エンベッドユーザーがこのように入力する SQLステートメントを構築します:
@advanced_1233_p
このメカニズムがアプリケーションのどこかで使用され、ユーザー入力が正しくないフィルター処理、 またはエンベッドなら、ユーザーはパスワード: ' OR ''=' のような (この例の場合) 特別に作られた入力を使用することによって、SQLの機能、またはステートメントに入り込むことが可能です。 このケースでは、ステートメントはこのようになります:
@advanced_1234_p
データベースに保存されたパスワードが何であっても、これは常に正しいものになります。 SQLインジェクションについての詳細は、用語集とリンク をご覧下さい。
@advanced_1235_h3
リテラルを無効にする
@advanced_1236_p
ユーザー入力が直接SQLステートメントに組み込まれなければ、 SQLインジェクションは不可能です。上記の問題の簡単な解決方法は、PreparedStatementを使用することです:
@advanced_1237_p
このデータベースは、ユーザー入力をデータベースに通す時、パラメータの使用を強制する方法を提供しています。 SQLステートメントの組み込まれたリテラルを無効にすることでこれを実行します。 次のステートメントを実行します:
@advanced_1238_p
#Afterwards, SQL statements with text and number literals are not allowed any more. That means, SQL statement of the form WHERE NAME='abc' or WHERE CustomerId=10 will fail. It is still possible to use PreparedStatements and parameters as described above. Also, it is still possible to generate SQL statements dynamically, and use the Statement API, as long as the SQL statements do not include literals. There is also a second mode where number literals are allowed: SET ALLOW_LITERALS NUMBERS. To allow all literals, execute SET ALLOW_LITERALS ALL (this is the default setting). Literals can only be enabled or disabled by an administrator.
@advanced_1239_h3
定数を使用する
@advanced_1240_p
リテラルを無効にするということは、ハードコード化された "定数" リテラルを無効にする、 ということも意味します。このデータベースは、CREATE CONSTANT コマンドを使用して定数を定義することをサポートしています。 定数はリテラルが有効であるときのみ定義することができますが、リテラルが無効の時でも使用することができます。 カラム名の名前の衝突を避けるために、定数は他のスキーマで定義できます:
@advanced_1241_p
リテラルが有効の時でも、クエリーやビューの中でハードコード化された数値リテラル、 またはテキストリテラルの代わりに、定数を使用する方がより良いでしょう。With 定数では、タイプミスはコンパイル時に発見され、ソースコードは理解、変更しやすくなります。
@advanced_1242_h3
ZERO() 関数を使用する
@advanced_1243_p
組み込み関数 ZERO() がすでにあるため、 数値 0 のための定数を作る必要はありません:
@advanced_1244_h2
#Restricting Class Loading and Usage
@advanced_1245_p
#By default there is no restriction on loading classes and executing Java code for admins. That means an admin may call system functions such as System.setProperty by executing:
@advanced_1246_p
#To restrict users (including admins) from loading classes and executing code, the list of allowed classes can be set in the system property h2.allowedClasses in the form of a comma separated list of classes or patterns (items ending with '*'). By default all classes are allowed. Example:
@advanced_1247_p
#This mechanism is used for all user classes, including database event listeners, trigger classes, user-defined functions, user-defined aggregate functions, and JDBC driver classes (with the exception of the H2 driver) when using the H2 Console.
@advanced_1248_h2
セキュリティプロトコル
@advanced_1249_p
次の文章は、このデータベースで使用されている セキュリティプロトコルのドキュメントです。これらの記述は非常に専門的で、 根本的なセキュリティの基本をすでに知っているセキュリティ専門家のみを対象としています。
@advanced_1250_h3
ユーザーパスワードの暗号化
@advanced_1251_p
ユーザーがデータベースに接続しようとする時、ユーザー名の組み合わせ、@、パスワードは SHA-256 を使用してハッシュ化され、このハッシュ値はデータベースに送信されます。 この手順は、クライアントとサーバー間の転送をアタッカーが聞ける (非暗号化できる) のであれば、 再使用する値からのアタッカーを試みることはありません。しかし、パスワードはクライアントとサーバー間で 暗号化されていない接続を使用している時でさえも、プレーンテキストで送信されることはありません これはもしユーザーが、異なる場面で同じパスワードを再利用しても、このパスワードはある程度まで保護されます。 詳細は"RFC 2617 - HTTP Authentication: Basic and Digest Access Authentication" もご覧下さい。
@advanced_1252_p
新しいデータベース、またはユーザーが作られた時、暗号化された安全なランダムの 新しいsalt値が生成されます。salt値のサイズは 64 bit です。 ランダムなsaltを使用することによって、多数の異なった (通常、使用された) パスワードのハッシュ値を アタッカーに再計算されるリスクが軽減します。
@advanced_1253_p
ユーザーパスワードのハッシュ値の組み合わせと (上記をご覧下さい) saltは SHA-256を使用してハッシュ化されます。 結果の値はデータベースに保存されます。ユーザーがデータベースに接続しようとする時、 データベースは、保存されたsalt値のユーザーパスワードのハッシュ値と計算されたハッシュ値を結合します。 他の製品は複数の反復 (ハッシュ値を繰り返しハッシュする) を使用していますが、 この製品ではサービス攻撃の拒絶 (アタッカーが偽のパスワードで接続しようとするところや、 サーバーがそれぞれのパスワードのハッシュ値を計算するのに長い時間費やすところ) のリスクを軽減するのに これは使用しません。理由は: もしアタッカーがハッシュ化されたパスワードにアクセスしたら、 プレーンテキストのデータにもアクセスできるため、パスワードはもはや必要ではなくなってしまいます。 もしデータが、保存されている他のコンピューターによって保護されていて、遠隔のみであるなら、 反復回数は全く必要とされません。
@advanced_1254_h3
ファイル暗号化
@advanced_1255_p
データベースファイルは二つの異なるアルゴリズムを使用して、暗号化されます: AES-128 と XTEA です (32 ラウンドを使用)。 XTEAをサポートする理由はパフォーマンス (XTEAはAESのおよそ二倍の速さです) と、AESが突然壊れた場合、代わりとなるアルゴリズムを 持っているからです。
@advanced_1256_p
ユーザーが暗号化されたデータベースに接続しようとした時、"file" という単語と、@と、 ファイルパスワードの組み合わせは、SHA-256を使用してハッシュ化されます。 このハッシュ値はサーバーに送信されます。
@advanced_1257_p
新しいデータベースファイルが作られた時、暗号化された安全なランダムの新しいsalt値が生成されます。 このsaltのサイズは 64 bitです。ファイルパスワードのハッシュとsalt値の組み合わせは、 SHA-256を使用して1024回ハッシュ化されます。反復の理由は、アタッカーが通常のパスワードの ハッシュ値を計算するよりも困難にするためです。
@advanced_1258_p
ハッシュ値の結果は、ブロック暗号アルゴリズム (AES-128、または 32ラウンドのXTEA) のためのキーとして 使用されます。その時、初期化ベクター (IV) キーは、再びSHA-256を使用してキーをハッシュ化することによって 計算されます。IVはアタッカーに知らないということを確認して下さい。秘密のIVを使用する理由は、 ウォーターマークアタック (電子透かし攻撃) を防御するためです。
@advanced_1259_p
データのブロックを保存する前に (それぞれのブロックは 8 バイト長)、次のオペレーションを 実行します: 最初に、IVはIVキー (同じblock cipher algorithmを使用して) でブロックナンバーを 暗号化することによって計算されます。このIVはXORを使用してプレーンテキストと併用されます。 結果データはAES-128、またはXTEAアルゴリズムを使用して暗号化されます。
@advanced_1260_p
復号化の時、オペレーションは反対に行われます。最初に、ブロックはキーを使用して復号化され、 その時、IVはXORを使用して復号化テキストと併用されます。
@advanced_1261_p
その結果、オペレーションのブロック暗号モードはCBT (Cipher-block chaining) ですが、 それぞれの連鎖はたったひとつのブロック長です。ECB (Electronic codebook) モードに優る利点は、 データのパターンが明らかにされない点で、複数のブロックCBCに優る利点は、 はじき出された暗号テキストビットは次のブロックではじき出されたプレーンテキストビットに伝播されないという点です。
@advanced_1262_p
データベース暗号化は、使用されていない間は (盗まれたノートパソコン等) 安全なデータベースだということを 意味します。これは、データベースが使用されている間に、アタッカーがファイルにアクセスしたというケースを 意味するのではありません。アタッカーが書き込みアクセスをした時、例えば、 彼はファイルの一部を古いバージョンに置き換え、データをこのように操ります。
@advanced_1263_p
ファイル暗号化はデータベースエンジンのパフォーマンスを低速にします。非暗号化モードと比較すると、 データベースオペレーションは、XTEAを使用する時はおよそ2.2倍長くかかり、 AESを使用する時は2.5倍長くかかります (エンベッドモード)。
@advanced_1264_h3
#Wrong Password Delay
@advanced_1265_p
#To protect against remote brute force password attacks, the delay after each unsuccessful login gets double as long. Use the system properties h2.delayWrongPasswordMin and h2.delayWrongPasswordMax to change the minimum (the default is 250 milliseconds) or maximum delay (the default is 4000 milliseconds, or 4 seconds). The delay only applies for those using the wrong password. Normally there is no delay for a user that knows the correct password, with one exception: after using the wrong password, there is a delay of up (randomly distributed) the same delay as for a wrong password. This is to protect against parallel brute force attacks, so that an attacker needs to wait for the whole delay. Delays are synchronized. This is also required to protect against parallel attacks.
@advanced_1266_h3
HTTPS 接続
@advanced_1267_p
webサーバーは、SSLServerSocketを使用したHTTP と HTTPS接続をサポートします。 簡単に開始できるように、デフォルトの自己認証された証明書がありますが、 カスタム証明書も同様にサポートされています。
@advanced_1268_h2
SSL/TLS 接続
@advanced_1269_p
遠隔SSL/TLS接続は、Java Secure Socket Extension (SSLServerSocket / SSLSocket) の使用をサポートしています。デフォルトでは、匿名のSSLは使用可能です。デフォルトの暗号化パッケージソフトは SSL_DH_anon_WITH_RC4_128_MD5 です。
@advanced_1270_p
#To use your own keystore, set the system properties javax.net.ssl.keyStore
and javax.net.ssl.keyStorePassword
before starting the H2 server and client. See also Customizing the Default Key and Trust Stores, Store Types, and Store Passwords for more information.
@advanced_1271_p
#To disable anonymous SSL, set the system property h2.enableAnonymousSSL
to false.
@advanced_1272_h2
汎用一意識別子 (UUID)
@advanced_1273_p
このデータベースはUUIDをサポートしています。 また、暗号化強力疑似乱数ジェネレーターを使用して新しいUUIDを作成する関数をサポートしています。 同じ値をもつ二つの無作為なUUIDが存在する可能性は、確率論を使用して計算されることができます。 "Birthday Paradox" もご覧下さい。標準化された無作為に生成されたUUIDは、122の無作為なビットを保持しています。 4ビットはバージョン(無作為に生成されたUUID) に、2ビットはバリアント (Leach-Salz) に使用されます。 このデータベースは組み込み関数 RANDOM_UUID() を使用してこのようなUUIDを生成することをサポートしています。 ここに、値の数字が生成された後、二つの 同一のUUIDが生じる可能性を見積もる小さなプログラムがあります:
@advanced_1274_p
いくつかの値は:
@advanced_1275_p
人の隕石に衝突するという年に一度の危険性は、170億に一回と見積もられ、それは、確率がおよそ 0.000'000'000'06 だということを意味しています。
@advanced_1276_h2
システムプロパティから読み込まれた設定
@advanced_1277_p
いくつかのデータベースの設定は、-DpropertyName=value を使用してコマンドラインで設定することができます。 通常、これらの設定は手動で変更することは必要とされていません。設定は大文字と小文字を区別しています。 例:
@advanced_1278_p
#The current value of the settings can be read in the table INFORMATION_SCHEMA.SETTINGS.
@advanced_1279_p
#For a complete list of settings, see SysProperties .
@advanced_1280_h2
#Setting the Server Bind Address
@advanced_1281_p
#Usually server sockets accept connections on any/all local addresses. This may be a problem on multi-homed hosts. To bind only to one address, use the system property h2.bindAddress. This setting is used for both regular server sockets and for SSL server sockets. IPv4 and IPv6 address formats are supported.
@advanced_1282_h2
#Limitations
@advanced_1283_p
#This database has the following known limitations:
@advanced_1284_li
#The maximum file size is currently 256 GB for the data, and 256 GB for the index. This number is excluding BLOB and CLOB data: Every CLOB or BLOB can be up to 256 GB as well.
@advanced_1285_li
#The maximum file size for FAT or FAT32 file systems is 4 GB. That means when using FAT or FAT32, the limit is 4 GB for the data. This is the limitation of the file system, and this database does not provide a workaround for this problem. The suggested solution is to use another file system.
@advanced_1286_li
#There is a limit on the complexity of SQL statements. Statements of the following form will result in a stack overflow exception:
@advanced_1287_li
#There is no limit for the following entities, except the memory and storage capacity: maximum identifier length, maximum number of tables, maximum number of columns, maximum number of indexes, maximum number of parameters, maximum number of triggers, and maximum number of other database objects.
@advanced_1288_li
#For limitations on data types, see the documentation of the respective Java data type or the data type documentation of this database.
@advanced_1289_h2
用語集とリンク
@advanced_1290_th
用語
@advanced_1291_th
説明
@advanced_1292_td
AES-128
@advanced_1293_td
#A block encryption algorithm. See also: Wikipedia: AES
@advanced_1294_td
Birthday Paradox
@advanced_1295_td
#Describes the higher than expected probability that two persons in a room have the same birthday. Also valid for randomly generated UUIDs. See also: Wikipedia: Birthday Paradox
@advanced_1296_td
Digest
@advanced_1297_td
#Protocol to protect a password (but not to protect data). See also: RFC 2617: HTTP Digest Access Authentication
@advanced_1298_td
GCJ
@advanced_1299_td
#Compiler for Java. GNU Compiler for the Java and NativeJ (commercial)
@advanced_1300_td
HTTPS
@advanced_1301_td
#A protocol to provide security to HTTP connections. See also: RFC 2818: HTTP Over TLS
@advanced_1302_td
Modes of Operation
@advanced_1303_a
#Wikipedia: Block cipher modes of operation
@advanced_1304_td
Salt
@advanced_1305_td
#Random number to increase the security of passwords. See also: Wikipedia: Key derivation function
@advanced_1306_td
SHA-256
@advanced_1307_td
#A cryptographic one-way hash function. See also: Wikipedia: SHA hash functions
@advanced_1308_td
SQLインジェクション
@advanced_1309_td
#A security vulnerability where an application generates SQL statements with embedded user input. See also: Wikipedia: SQL Injection
@advanced_1310_td
Watermark Attack (透かし攻撃)
@advanced_1311_td
#Security problem of certain encryption programs where the existence of certain data can be proven without decrypting. For more information, search in the internet for 'watermark attack cryptoloop'
@advanced_1312_td
SSL/TLS
@advanced_1313_td
#Secure Sockets Layer / Transport Layer Security. See also: Java Secure Socket Extension (JSSE)
@advanced_1314_td
XTEA
@advanced_1315_td
#A block encryption algorithm. See also: Wikipedia: XTEA
@build_1000_h1
ビルド
@build_1001_a
ポータビリティ
@build_1002_a
環境
@build_1003_a
ソフトウェアのビルド
@build_1004_a
#Build Targets
@build_1005_a
Maven 2 の利用
@build_1006_a
#Translating
@build_1007_a
#Providing Patches
@build_1008_h2
ポータビリティ
@build_1009_p
このデータベースはJavaによって記述されているため、多くのプラットフォームで動作します。また、GCJを利用することで、ネイティブでも実行可能に(ネイティブコードに)コンパイルすることが可能です
@build_1010_h2
環境
@build_1011_p
#A Java Runtime Environment (JRE) version 1.4 or higher is required to run this database.
@build_1012_p
#To build the database executables, the following software stack was used. Newer version or compatible software works too.
@build_1013_li
#Mac OS X and Windows XP
@build_1014_li
#Sun JDK Version 1.4, 1.5, and 1.6
@build_1015_li
#Eclipse Version 3.4
@build_1016_li
#Eclipse Plugins: Subclipse 1.4.6, EclEmma Java Code Coverage 1.3.0, Eclipse Checkstyle Plug-in 4.4.2
@build_1017_li
#Mozilla Firefox 3.0
@build_1018_li
#OpenOffice 3.0
@build_1019_li
#NSIS 2.38 (Nullsoft Scriptable Install System)
@build_1020_li
#Maven 2.0.9
@build_1021_li
YourKit Java Profiler
@build_1022_h2
ソフトウェアのビルド
@build_1023_p
#You need to install a JDK, for example the Sun JDK version 1.4, 1.5 or 1.6. On the command line, go to the directory h2 and execute the following command:
@build_1024_p
#For Linux and OS X, use ./build.sh
instead of build
.
@build_1025_p
#You will get a list of targets. If you want to build the jar file, execute (Windows):
@build_1026_h3
#Switching the Source Code
@build_1027_p
#By default the source code uses Java 1.6 features, however Java 1.4 and 1.5 are supported as well. To disable Java 1.6 specific features, run:
@build_1028_h2
#Build Targets
@build_1029_p
#The build system can generate smaller jar files as well. The following targets are currently supported:
@build_1030_li
#jarClient: Create the h2client.jar. This only contains the remote JDBC implementation.
@build_1031_li
#jarSmall: Create the file h2small.jar. This only contains the embedded database. Debug information is disabled.
@build_1032_li
#jarJaqu: Create the file h2jaqu.jar. This only contains the JaQu (Java Query) implementation. All other jar files do not include JaQu.
@build_1033_li
#javadocImpl: Create the Javadocs of the implementation.
@build_1034_p
#To create the h2client.jar file, go to the directory h2 and execute the following command:
@build_1035_h2
Maven 2 の利用
@build_1036_h3
Centralリポジトリの利用
@build_1037_p
依存関係を取ることで、Maven 2プロジェクトでデータベースを組み込むことも可能です。例:
@build_1038_p
#New versions of this database are first uploaded to http://hsql.sourceforge.net/m2-repo/ and then automatically synchronized with the main maven repository; however after a new release it may take a few hours before they are available there.
@build_1039_h3
スナップショットバージョンの利用
@build_1040_p
スナップショット版のH2.jarファイルをビルドし、ローカルのMaven2リポジトリを更新するには以下のコマンドを実行します:
@build_1041_p
実行後、Maven2プロジェクトにH2DBを依存させ組み込むことが出来るようになります:
@build_1042_h2
#Translating
@build_1043_p
#The translation of this software is split into the following parts:
@build_1044_li
#H2 Console: src/main/org/h2/server/web/res/_text_*.properties
@build_1045_li
#Error messages: src/main/org/h2/res/_messages_*.properties
@build_1046_li
#Web site: src/docsrc/text/_docs_*.utf8.txt
@build_1047_p
#To translate the H2 Console, start it and select Options / Translate. The conversion between UTF-8 and Java encoding (using the \u syntax), as well as the HTML entities (&#..;) is automated by running the tool PropertiesToUTF8. The web site translation is automated as well, using build docs
.
@build_1048_h2
#Providing Patches
@build_1049_p
#If you like to provide patches, please consider the following guidelines to simplify merging them:
@build_1050_li
#Only use Java 1.4 features (do not use Java 1.5 or 1.6) (see Environment).
@build_1051_li
#Follow the coding style used in the project, use Checkstyle (see above) to check the coding style. The checkstyle configuration is in src/installer/checkstyle.xml
.
@build_1052_li
#Please provide test cases and integrate them into the test suite. For Java level tests, see src/test/org/h2/test/TestAll.java
. For SQL level tests, see src/test/org/h2/test/test.in.txt
or testSimple.in.txt
.
@build_1053_li
#The test cases should cover at least 90% of the changed and new code; use a code coverage tool to verify that (see above).
@build_1054_li
#Verify that you did not break other features: Run the test cases by executing build test
.
@build_1055_li
#Provide end user documentation if required ( src/docsrc/html/*
).
@build_1056_li
#Document grammar changes in src/main/org/h2/res/help.csv
@build_1057_li
#Provide a change log entry ( src/docsrc/html/changelog.html
).
@build_1058_li
#Verify the spelling using build spellcheck
. If required add the new words to src/tools/org/h2/build/doc/dictionary.txt
.
@build_1059_li
#Verify the formatting using build docs
and build javadoc
.
@build_1060_li
#Submit patches as .patch files (compressed if big). To create a patch, use for example Eclipse Team/Create Patch.
@changelog_1000_h1
変更履歴
@changelog_1001_h2
#Next Version (unreleased)
@changelog_1002_li
#-
@changelog_1003_h2
#Version 1.1.109 (2009-03-14)
@changelog_1004_li
#The optimization for IN(...) is now only used if comparing a column with an index.
@changelog_1005_li
#User defined functions can now be deterministic (see CREATE ALIAS documentation).
@changelog_1006_li
#Multiple nested queries in the FROM clause with parameters did not always work.
@changelog_1007_li
#When converting CLOB to BINARY, each character resulted in one byte. Now, the text is parsed as a hex as when converting VARCHAR.
@changelog_1008_li
#New experimental NIO storage mechanism with both FileChannel and memory mapped files. To use it, use the file name prefix nio: or nioMapped: as in jdbc:h2:nio:~/test. So far it looks like NIO storage is faster on Mac OS but slower on some Windows systems. Thanks a lot to Jan Kotek for the patch!
@changelog_1009_li
#The functions BITOR, BITAND, BITXOR, and MOD now accept and return BIGINT instead of INT.
@changelog_1010_li
#Could not use the same linked table multiple times in the same query.
@changelog_1011_li
#Bugs in the server-less multi-connection mode have been fixed.
@changelog_1012_li
#Column names could not be named "UNIQUE" (with the quotes).
@changelog_1013_li
#New system function TRANSACTION_ID() to get the current transaction identifier for a session.
@changelog_1014_h2
#Version 1.1.108 (2009-02-28)
@changelog_1015_li
#When the shutdown hook closed the database, the last log file was deleted too early. This could cause uncommitted changes to be persisted.
@changelog_1016_li
#JdbcConnectionPool: it was possible to set a negative connection pool size.
@changelog_1017_li
#Fulltext search did not support table names with a backslash.
@changelog_1018_li
#The internal IntArray class did not work correctly when initialized with a zero length array.
@changelog_1019_li
#The H2 Console web application (war file) did only support ASCII characters. Now UTF-8 is supported.
@changelog_1020_li
#DATEADD does no longer require that the argument is a timestamp.
@changelog_1021_li
#The database file locking mechanism didn't work correctly on Mac OS.
@changelog_1022_li
#Some built-in functions reported the wrong precision, scale, and display size.
@changelog_1023_li
#MySQL compatibility for CREATE TABLE is improved (UNSIGNED, KEY).
@changelog_1024_li
#Recovery did not work if there were more than 255 lobs stored as files.
@changelog_1025_li
#New experimental mode to support multiple read-write connections without starting a server. To enable this mode, append ;FILE_LOCK=SERIALIZED;OPEN_NEW=TRUE to the database URL. Don't expect high performance when multiple concurrent writers.
@changelog_1026_li
#In a web application, the database classes are not unloaded if a connection is open. This may cause out of memory when re-deploying a web application. The DbStarter is changed to close all connections to the configured database (by executing SHUTDOWN).
@changelog_1027_li
#The WebServlet did not close the database when un-deploying the web application.
@changelog_1028_li
#The exception message of failed INSERT or MERGE statements now includes all values and the row number.
@changelog_1029_li
#If opening a database failed with an out of memory exception, some files were not closed.
@changelog_1030_li
#Optimizer: the expected runtime calculation was incorrect. The fixed calculation should give slightly better query plans when using many joins.
@changelog_1031_li
#Improved exception message when connecting to a just started server fails.
@changelog_1032_li
#Connection.isValid is a bit faster.
@changelog_1033_li
#H2 Console: The autocomplete feature has been improved a bit. It can now better parse conditions.
@changelog_1034_li
#When restarting a web application in Tomcat, an exception was thrown sometimes. In most cases this was a NullPointerException. A workaround in H2 has been implemented. The root cause of the problem is now documented in the FAQ: Tomcat sets all static fields (final or non-final) to null when unloading a web application. A workaround is to put the h2.jar in the lib directory, or set the system property org.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES to false.
@changelog_1035_h2
#Version 1.1.107 (2009-01-24)
@changelog_1036_li
#Some DatabaseMetaData operations did not work for non-admin users for versions 1.1.x.
@changelog_1037_li
#The MySQL compatibility extension fromUnixTime now used the English locale.
@changelog_1038_li
#When using LOG=2 and repeatedly updating the last row rows of a table, the index file grew quickly.
@changelog_1039_li
#In versions 1.1.105 and 1.1.106, encrypted script files of earlier versions could not be processed. This is now again possible. The problem was that such script files were stored in a special format (STORAGE=TEXT) but support for this format was removed in version 1.1.105.
@changelog_1040_li
#Enabling the trace mechanism by creating a specially named file is no longer supported.
@changelog_1041_h2
#Version 1.1.106 (2009-01-04)
@changelog_1042_li
#Statement.setQueryTimeout did not work correctly for some statements.
@changelog_1043_li
#CREATE DOMAIN: Built-in data types can now only be changed if no tables exist.
@changelog_1044_li
#Linked tables: a workaround for Oracle DATE columns has been implemented.
@changelog_1045_li
#DatabaseMetaData.getPrimaryKeys: The column PK_NAME now contains the constraint name instead of the index name (compatibility for PostgreSQL and Derby).
@changelog_1046_li
#Using IN(..) inside a IN(SELECT..) did not always work.
@changelog_1047_li
#Views with IN(..) that used a view itself did not work.
@changelog_1048_li
#Union queries with LIMIT or ORDER BY that are used in a view or subquery did not work.
@changelog_1049_li
#The license change a bit: so far the license was modified to say 'Swiss law'. This is now changed back to the original 'US law'. This was requested by a user, and I don't see a problem.
@changelog_1050_li
#Constraints for local temporary tables now session scoped. So far they were global. Thanks a lot to Eric Faulhaber for finding and fixing this problem!
@changelog_1051_li
#When using the auto-server mode, and if the lock file was modified in the future, the wrong exception was thrown ('Connection is broken' instead of 'Error opening database: Lock file modified in the future').
@changelog_1052_h2
#Version 1.1.105 (2008-12-19)
@changelog_1053_li
#The setting STORAGE=TEXT is no longer supported.
@changelog_1054_li
#Deleting a database using the tool DeleteDbFiles deleted LOB files of other databases in the same directory.
@changelog_1055_li
#When used in a subquery, LIKE and IN(..) did not work correctly sometimes.
@changelog_1056_li
#The fulltext search documentation has been improved.
@changelog_1057_li
#ARRAY_GET returned the wrong data type (ARRAY). Now it returns VARCHAR.
@changelog_1058_li
#Natural join: the joined columns are not repeated any more when using SELECT *.
@changelog_1059_li
#User defined aggregate functions: the method getType expected internal data types instead of SQL types.
@changelog_1060_li
#User defined aggregate functions did not work if there was no group by expression.
@changelog_1061_li
#MySQL compatibility: support for := assignment as in @sum:=@sum+x
@changelog_1062_li
#INSERT INTO TEST(SELECT * FROM TEST) is now supported.
@changelog_1063_li
#Each session threw an invisible exception when garbage collected.
@changelog_1064_li
#Foreign key constraints that refer to a quoted column did not work.
@changelog_1065_li
#New meta data column INFORMATION_SCHEMA.TABLES.LAST_MODIFICATION to get the table modification counter.
@changelog_1066_li
#Shell: line comments didn't work correctly.
@changelog_1067_li
#H2 Console: Columns are now listed for up to 500 tables instead of 100.
@changelog_1068_li
#H2 Console: Cmd+Enter executes the current statement, Alt+Space for autocomplete.
@changelog_1069_li
#JaQu: the maximum length of a column can now be defined using maxLength. For an example, see Product.java (maxLength(category, 255)).
@changelog_1070_li
#R&\#305;dvan A&\#287;ar has completed the Turkish translation of the H2 Console. Thanks a lot!
@changelog_1071_h2
#Version 1.1.104 (2008-11-28)
@changelog_1072_li
#If a query that was used like a table contained group by and was ordered by an expression that is not in the column list, an exception was thrown.
@changelog_1073_li
#JaQu: tables are now auto-created when running a query.
@changelog_1074_li
#The optimizer had problems with function tables (for example CSVREAD and FTL_SEARCH). A new system property h2.estimatedFunctionTableRows (default 1000) defines how many rows can be expected in the table.
@changelog_1075_li
#The function SUM could overflow when using large values. It returns now a data type that is safe.
@changelog_1076_li
#The function AVG could overflow when using large values. Fixed.
@changelog_1077_li
#The emergency reserve file has been removed. It didn't provide an appropriate solution for the problem. It is still possible for an application to detect and deal with the low disk space problem (deleting temporary files for example) using DatabaseEventListener.diskSpaceIsLow, but this method is now always called with stillAvailable=0.
@changelog_1078_li
#Build: JAVA_HOME is now automatically detected on Mac OS X.
@changelog_1079_li
#Testing for local connections was very slow on some systems.
@changelog_1080_li
#The cache memory usage calculation is more conservative.
@changelog_1081_li
#Allocating space got slower and slower the larger the database.
@changelog_1082_li
#ALTER TABLE ALTER COLUMN could throw the wrong exception in the last version (Table not found).
@changelog_1083_li
#Updatable result sets: the key columns can now be updated.
@changelog_1084_li
#The H2DatabaseProvider for ActiveObjects is now included in the tools section.
@changelog_1085_li
#The H2Platform for Oracle Toplink Essential has been improved a bit.
@changelog_1086_li
#The Windows service to start H2 didn't work in version 1.1.
@changelog_1087_li
#File systems with a maximum file size (for example FAT) are now supported using the file prefix 'split:'. In this case the files are split in parts of 1 GB. Example URL: jdbc:h2:split:~/db/test. If you want to split into parts of 1 MB, use jdbc:h2:split:20:~/db/test (the part size is 1 << x, the default is 30 meaning 1 GB).
@changelog_1088_li
#The database now tries to detect if the classloader or virtual machine has almost shut down by checking if static final variables are set to null. This should help reduce exceptions when stopping the web application.
@changelog_1089_li
#Compatibility for MS SQL Server DATEDIFF(YYYY, .., ..)
@changelog_1090_li
#ResultSet.getObject for CLOB or BLOB will return a java.sql.Clob / java.sql.Blob object instead of a java.io.Reader / java.io.InputStream as in version 1.0. This behavior can be changed using the system property h2.returnLobObjects (true by default for version 1.1).
@changelog_1091_li
#The interface CloseListener has a new method 'remove' that is called when the trigger is dropped.
@changelog_1092_li
#Fulltext search: there was a memory leak when creating and dropping fulltext indexes in a loop.
@changelog_1093_h2
#Version 1.1.103 (2008-11-07)
@changelog_1094_li
#Could not order by a formula when the formula was in the group by list but not in the select list.
@changelog_1095_li
#Date values that match the daylight saving time end were not allowed in times zones were the daylight saving time ends at midnight, for years larger than 2037. Example: timezone Brasilia, date 2042-10-12. This is a problem of Java, however a workaround is implemented in H2 that solves most problems (except the problems of java.util.Date itself).
@changelog_1096_li
#ALTER TABLE used a lot of memory when using multi-version concurrency.
@changelog_1097_li
#Referential integrity for in-memory databases didn't work in some cases in version 1.1.102.
@changelog_1098_li
#New column INFORMATION_SCHEMA.COLUMNS.SEQUENCE_NAME to get the name of the sequence for auto-increment columns.
@changelog_1099_li
#Aliases for built-in data types (such as MEDIUMBLOB which is an alias for BLOB) can now be re-mapped to another data type using CREATE DOMAIN. However main built-in data types (such as INTEGER) can not be re-mapped.
@changelog_1100_li
#The Japanese translation has been completed by Masahiro Ikemoto. Thanks a lot!
@changelog_1101_li
#Improved PostgreSQL compatibility for NEXTVAL and CURRVAL.
@changelog_1102_li
#Less heap memory is needed when multiple databases are open at the same time: The memory reserve (used to rollback after out of memory) is now global and no longer allocated for each database separately.
@changelog_1103_li
#New system property h2.browser to set the browser to use.
@changelog_1104_li
#To start the browser, java.awt.Desktop.browse is now used if available.
@changelog_1105_h2
#Version 1.1.102 (2008-10-24)
@changelog_1106_li
#The French translation of the H2 Console has been improved by Olivier Parent. Thanks a lot!
@changelog_1107_li
#There was a memory leak when creating and dropping tables and indexes in a loop (persistent database only).
@changelog_1108_li
#SET LOG 2 was not effective if executed after opening the database.
@changelog_1109_li
#Translating the H2 Console is now simpler.
@changelog_1110_li
#Common exception (error code 23*) are no longer written to the .trace.db file by default.
@changelog_1111_li
#In-memory databases don't write LOBs to files any longer.
@changelog_1112_li
#Self referencing constraints didn't restrict deleting rows that reference itself if there is another row that references it.
@changelog_1113_li
#ResultSetMetaData.getColumnName now returns the alias name except for columns.
@changelog_1114_li
#Temporary files are now deleted when the database is closed, even if they were not garbage collected so far.
@changelog_1115_h2
#Version 1.1.101 (2008-10-17)
@changelog_1116_li
#Errors with code 42000 - 42999 are no longer written to the trace file by default.
@changelog_1117_li
#Queries with more than 10 tables are now faster.
@changelog_1118_li
#Opening a connection with AUTO_SERVER=TRUE is now fast when the database is already open in another process (less than 0.01 seconds instead of 2 seconds).
@changelog_1119_li
#IF [NOT] EXISTS is supported for named constraints in ALTER TABLE ... ADD/DROP CONSTRAINT.
@changelog_1120_li
#The error messages have been translated to Spanish by Dario V. Fassi. Thanks a lot!
@changelog_1121_li
#Linked tables: the automatic connection sharing didn't work. Actually the system property h2.shareLinkedConnections was working in the opposite direction: it was disabled when set to true. Now it works as expected.
@changelog_1122_li
#Opening large database is now faster.
@changelog_1123_li
#New system property h2.socketConnectTimeout, the timeout in milliseconds to connect to a server. The default is 2000 (2 seconds).
@changelog_1124_li
#The wrong parameters were bound to subqueries with parameters, specially when using IN(SELECT ...) and IN(...).
@changelog_1125_li
#Unset parameters were not detected when the query was re-compiled.
@changelog_1126_li
#New functions ISO_YEAR, ISO_WEEK, ISO_DAY_OF_WEEK. Thanks a lot to Robert Rathsack for implementing those!
@changelog_1127_li
#The date functions DAYOFYEAR, DAYOFMONTH, DAYOFWEEK are now called DAY_OF_YEAR, DAY_OF_MONTH, DAY_OF_WEEK (the old names still work).
@changelog_1128_li
#An out of memory error while deleting or updating many rows could result in a strange exception.
@changelog_1129_li
#Linked tables: compatibility with MS SQL Server has been improved.
@changelog_1130_li
#Renaming tables that have foreign keys with cascade didn't work correctly.
@changelog_1131_li
#The auto-reconnect feature didn't work when using the auto-server mode. Fixed.
@changelog_1132_li
#Fulltext search: new method FT_DROP_INDEX.
@changelog_1133_li
#The optimization to group using an index didn't work in some cases in version 1.1 (see also system property h2.optimizeGroupSorted).
@changelog_1134_li
#OSGi meta data is included in the manifest file. An OSGi BundleActivator is included: it loads the database driver when starting the bundle, and unloads it when stopping the bundle.
@changelog_1135_li
#The default value for MAX_MEMORY_UNDO is now 50000.
@changelog_1136_li
#For alias columns, ResultSetMetaData.getTableName() and getColumnName() now return the real table and column name in the default mode.
@changelog_1137_li
#In SQL scripts created with SCRIPT TO, schemas are now only created if they don't exist yet.
@changelog_1138_li
#After re-connecting to a database, the database event listener (if set) is informed about it.
@changelog_1139_li
#Local temporary tables now support indexes. Thanks a lot to Matt Roy!
@changelog_1140_li
#RUNSCRIPT no longer uses a temporary file.
@changelog_1141_li
#New system table INFORMATION_SCHEMA.SESSION_STATE containing the SQL statements that make up the session state. The list currently contains variables (SET @..) and local temporary tables (without data).
@changelog_1142_li
#After an automatic re-connect, part of the session state stays (the part that is stored in the SESSION_STATE table).
@changelog_1143_li
#The build didn't work if the directory temp didn't exist before.
@changelog_1144_li
#New system property h2.maxReconnect (default 3) to limit the number of re-connects for the same SQL statement (this is usually only important for SHUTDOWN).
@changelog_1145_li
#WHERE .. IN (SELECT ...) could throw a NullPointerException.
@changelog_1146_li
#Improved Glassfish / Toplink support in H2Platform thanks to Marcio Borges from Brazil. Thanks a lot!
@changelog_1147_h2
#Version 1.1.100 (2008-10-04)
@changelog_1148_li
#In version 1.1, the following system properties are now enabled by default: h2.lobFilesInDirectories, h2.optimizeGroupSorted, h2.optimizeInJoin, h2.shareLinkedConnections
@changelog_1149_li
#The H2 Console tool now works with the JDBC-ODBC bridge.
@changelog_1150_li
#The H2 Console tool now supports command line options to start things separately.
@changelog_1151_li
#Large objects did not work for in-memory databases in server mode in Linux.
@changelog_1152_li
#Connections from a local address other than 'localhost' were not allowed if remote connections were disabled. This was always a problem, but only got visible in the last release because the server no longer connects to 'localhost' if networked.
@changelog_1153_li
#The h2console.war can now be built using the Java build.
@changelog_1154_li
#By default, databases are shared in the same process. For read-only databases this causes unnecessary synchronization, but safes memory. If you want that each connection opens its own database, append ;OPEN_NEW=TRUE to the database URL.
@changelog_1155_li
#New auto-reconnect feature will cause the JDBC driver to reconnect to the database if the connection is lost. To enable, append ;AUTO_RECONNECT=TRUE to the database URL. This is specially helpful when using AUTO_SERVER. AUTO_SERVER automatically uses auto-reconnect.
@changelog_1156_li
#CreateCluster: the property 'serverlist' is now called 'serverList'.
@changelog_1157_li
#The ConvertTraceFile tool could not parse some files because the trace mechanism did not encode prepared statement parameters.
@changelog_1158_li
#Databases names can now be one character long (the minimum size used to be 2 characters).
@changelog_1159_h2
#Version 1.0.79 (2008-09-26)
@changelog_1160_li
#Linked tables that point to the same database can now share the connection within the same database. Access to the same connection is serialized. To enable this feature, set the system property h2.shareLinkedConnections to true.
@changelog_1161_li
#Multiple processes can now access the same database without having to explicitly start the server. To do that, append ;AUTO_SERVER=TRUE to the database URL. In this case, the server is started automatically if the connection is in embedded mode, and the server mode is used if a server is running. If the process that opened the first connection is closed, the other client need to reconnect (there is no automatic re-connect so far). Remote connections are allowed, but only to this database.
@changelog_1162_li
#The server tool now displays the correct IP address if networked.
@changelog_1163_li
#Can now start a TCP server with port 0 (automatically select a port).
@changelog_1164_li
#Result sets with just a unique index can now be updated (previously a primary key was required).
@changelog_1165_li
#LINKED TABLE: the schema name can now be set. When multiple tables exist in different schema, and the schema name is not set, an exception is thrown.
@changelog_1166_li
#LINKED TABLE: worked around a bug in Oracle with the CHAR data type.
@changelog_1167_li
#Faster hash code calculation for large binary arrays.
@changelog_1168_li
#Faster storage re-use algorithm thanks to Greg Dhuse from cleversafe.com.
@changelog_1169_li
#The database supports the SHOW command for better MySQL and PostgreSQL compatibility.
@changelog_1170_li
#The H2 Console now abbreviates large texts in results.
@changelog_1171_li
#Multiple UNION queries could not be used in derived tables.
@changelog_1172_li
#Linked tables can now be read-only.
@changelog_1173_li
#Temporary linked tables are now supported.
@changelog_1174_li
#It was possible to create tables in read-only databases.
@changelog_1175_li
#SET SCHEMA_SEARCH_PATH is now documented.
@changelog_1176_li
#SET SCHEMA did not work for views.
@changelog_1177_li
#Row level locking for MVCC is now enabled. The exception 'Concurrent update in table ...' is still thrown, but only after the lock timeout.
@changelog_1178_li
#The maximum log file size setting was ignored for large databases.
@changelog_1179_li
#Multi-Version Concurrency (MVCC) may no longer be used when using the multi-threaded kernel feature (MULTI_THREADED). An exception is thrown when trying to connect with both settings. Additional synchronization is required before those features can be used together.
@changelog_1180_li
#The data type JAVA_OBJECT could not be used in updatable result sets.
@changelog_1181_li
#The system property h2.optimizeInJoin did not work correctly.
@changelog_1182_li
#Conditions such as ID=? AND ID>? were slow.
@changelog_1183_h2
#Version 1.0.78 (2008-08-28)
@changelog_1184_li
#The documentation no longer uses a frameset (except the Javadocs).
@changelog_1185_li
#When using DB_CLOSE_DELAY, sometimes a NullPointerException is thrown when the database is opened almost at the same time as it is closed automatically. Thanks a lot to Dmitry Pekar for finding this!
@changelog_1186_li
#Java methods with variable number of parameters can now be used (for Java 1.5 or newer).
@changelog_1187_li
#The Japanese translation has been improved by Masahiro Ikemoto. Thanks a lot!
@changelog_1188_li
#The H2 Console replaced an empty user name with a single space.
@changelog_1189_li
#The build target 'build jarSmall' now includes the embedded database.
@changelog_1190_li
#JdbcDataSource now keeps the password in a char array where possible.
@changelog_1191_li
#ResultSet.absolute did not always work with large result sets.
@changelog_1192_li
#Column aliases can now be used in GROUP BY and HAVING.
@changelog_1193_li
#Jason Brittain has contributed MySQL date functions. Thanks a lot! They are not in the h2.jar file currently, but in src/tools/org/h2/mode/FunctionsMySQL.java. To install, add this class to the classpath and call FunctionsMySQL.register(conn) in the Java code.
@changelog_1194_h2
#Version 1.0.77 (2008-08-16)
@changelog_1195_li
#JaQu is now using prepared statements and supports Date, Time, Timestamp.
@changelog_1196_li
#When using remote in-memory databases, large LOB objects did not work.
@changelog_1197_li
#Timestamp columns such as TIMESTAMP(6) were not compatible to other database.
@changelog_1198_li
#Opening a large database was slow if there was a problem opening the previous time.
@changelog_1199_li
#NOT IN(SELECT ...) was incorrect if the subquery returns no rows.
@changelog_1200_li
#CREATE TABLE AS SELECT did not work correctly in the multi-version concurrency mode.
@changelog_1201_li
#Support a comma before closing a list, as in: create table test(id int,)
@changelog_1202_li
#MySQL compatibility: linked tables had lower case column names on some systems.
@changelog_1203_li
#DB2 compatibility: the DB2 fetch-first-clause is supported.
@changelog_1204_li
#Oracle compatibility: old style outer join syntax using (+) did work correctly sometimes.
@changelog_1205_li
#ResultSet.setFetchSize is now supported.
@changelog_1206_li
#It has been reported that when using Install4j on some Linux systems and enabling the 'pack200' option, the h2.jar becomes corrupted by the install process, causing application failure. A workaround is to add an empty file h2.jar.nopack next to the h2.jar file. The reason for this problem is not known.
@changelog_1207_h2
#Version 1.0.76 (2008-07-27)
@changelog_1208_li
#The comment of a domain (user defined data type) is now used as the default column comment when creating a column with this domain.
@changelog_1209_li
#Invalid database names are now detected and a better error message is thrown.
@changelog_1210_li
#ResultSetMetaData.getColumnClassName now returns the correct class name for BLOB and CLOB.
@changelog_1211_li
#Fixed the Oracle mode: Oracle allows multiple rows only where all columns of the unique index are NULL.
@changelog_1212_li
#There is a problem with Hibernate when using Boolean columns. A patch for Hibernate has been submitted at http://opensource.atlassian.com/projects/hibernate/browse/HHH-3401
@changelog_1213_li
#ORDER BY on tableName.columnName didn't work correctly if the column name was also used as an alias.
@changelog_1214_li
#H2 Console: The progress display when opening a database has been improved.
@changelog_1215_li
#The error message when the server doesn't start has been improved.
@changelog_1216_li
#Key values can now be changed in updatable result sets.
@changelog_1217_li
#Changes in updatable result sets are now visible even when resetting the result set.
@changelog_1218_li
#Temporary files were sometimes deleted too late when executing large insert, update, or delete operations.
@changelog_1219_li
#The database file was growing after deleting many rows, and after large update operations.
@changelog_1220_h2
#Version 1.0.75 (2008-07-14)
@changelog_1221_li
#Multi version concurrency (MVCC): when a row was updated or deleted, but this change was rolled back, the row was not visible by other sessions if no index was used to access it. Fixed.
@changelog_1222_li
#Views with multiple joined tables (where one was an outer join) couldn't be used in some cases. Fixed.
@changelog_1223_li
#The CSVREAD method did not process NULL correctly when using a whitespace field separator.
@changelog_1224_li
#Fixed the Oracle mode: Oracle allows multiple rows with NULL in a unique index.
@changelog_1225_li
#Running out of memory could result in incomplete transactions or corrupted databases. Fixed.
@changelog_1226_li
#When using order by in a query that uses the same table multiple times, the order could be incorrect. Fixed.
@changelog_1227_li
#Referential constraint checking improvement: now the constraint is only checked if the key column values change.
@changelog_1228_li
#Some database metadata calls returned the wrong data type for DATA_TYPE columns.
@changelog_1229_li
#The Lucene fulltext index was empty when opening a database with fulltext index enabled, and re-indexing it didn't work. Fixed.
@changelog_1230_li
#The character '$' could not be used in identifier names (table name, column names and so on). Fixed.
@changelog_1231_li
#The new method org.h2.tools.Server.startWebServer(conn) starts the H2 Console to inspect a database while debugging.
@changelog_1232_li
#Stopping a WebServer didn't always work. Fixed.
@changelog_1233_h2
#Version 1.0.74 (2008-06-21)
@changelog_1234_li
#Work on row level locking has been started (but there is nothing usable yet).
@changelog_1235_li
#JaQu (Java Query), a tool similar to LINQ (Language Integrated Query; from Microsoft) is now included under src/tools/org/h2/jaqu. A small sample application is included under src/test/org/h2/test/jaqu.
@changelog_1236_li
#The source code is now switched to Java 1.6 by default. To switch back to Java 1.4, run 'build compile'. The h2.jar file is still Java 1.4.
@changelog_1237_li
#The ChangePassword tool is now called ChangeFileEncryption.
@changelog_1238_li
#It is no longer allowed to create columns with the data type NULL. Also, it is no longer allowed to convert a column to the data type NULL. This was possible before but caused data loss.
@changelog_1239_li
#When using computed columns or default values with a different data type than the column data type, a class cast exception could occur. Fixed.
@changelog_1240_li
#Opening databases larger than 1 GB was sometimes very slow if a lot of data was deleted previously. Fixed.
@changelog_1241_li
#RUNSCRIPT could throw a NullPointerException if the script name was an expression.
@changelog_1242_li
#Improved compatibility. New compatibility modes for Oracle and Derby. New compatibility flag uniqueIndexNullDistinct to only allow one row with 'NULL' in a unique index. This flag is enabled for Derby, Oracle, MSSQLServer, and HSQLDB.
@changelog_1243_li
#Linked tables: To view the statements that are executed against the target table, set the trace level to 3.
@changelog_1244_li
#RunScript tool: new options to show and check the results of queries.
@changelog_1245_li
#Deadlocks are now detected. One transaction is rolled back automatically.
@changelog_1246_li
#The Lucene fulltext index was always re-created when opening a database with fulltext index enabled.
@changelog_1247_li
#Support for overloaded Java methods. A user defined function can now be bound to multiple Java methods, if the Java methods have the same name but a different number of parameters. Thanks to Gary Tong for providing a patch!
@changelog_1248_h2
#Version 1.0.73 (2008-05-31)
@changelog_1249_li
#ParameterMetaData now returns the right data type for most conditions, as in WHERE ID=?.
@changelog_1250_li
#The table SYSTEM_RANGE now supports expressions and parameters.
@changelog_1251_li
#New column INFORMATION_SCHEMA.CONSTRAINTS.UNIQUE_INDEX_NAME that contains the name of the unique index used to enforce this constraint, if there is such an index.
@changelog_1252_li
#SET QUERY_TIMEOUT and Statement.setQueryTimeout no longer commits a transaction. The same applies to SET @VARIABLE, SET LOCK_TIMEOUT, SET TRACE_LEVEL_*, SET THROTTLE, and SET PATH.
@changelog_1253_li
#The SCRIPT command does now emit IF NOT EXISTS for CREATE ROLE.
@changelog_1254_li
#MySQL compatibility: auto_increment column are no longer automatically converted to primary key columns.
@changelog_1255_li
#PostgreSQL compatibility: support for BOOL_OR and BOOL_AND aggregate functions.
@changelog_1256_li
#Negative scale values for DECIMAL or NUMBER columns are now supported in regular tables and in linked tables.
@changelog_1257_li
#A role or right can now be granted or revoked multiple times without getting an exception.
@changelog_1258_li
#Infinite numbers in SQL scripts are listed as POWER(0, -1)), negative infinite as (-POWER(0, -1)), and NaN (not a number) as SQRT(-1).
@changelog_1259_li
#The special double and float values 'NaN' (not a number) did not work correctly when sorting or comparing.
@changelog_1260_li
#The fulltext search did not support CLOB data types.
@changelog_1261_li
#If the drive with the database files was disconnected or unmounted while writing, sometimes a stack overflow exception was thrown instead of a IO exception.
@changelog_1262_li
#The H2 Console could not be shut down from within the tool if the browser supports keepAlive (most browsers do).
@changelog_1263_li
#If the password was passed as a char array, it was kept in an internal buffer longer than required. Theoretically the password could have been stolen if the main memory was swapped to disk before the garbage collection was run.
@changelog_1264_h2
#Version 1.0.72 (2008-05-10)
@changelog_1265_li
#Some databases could not be opened when appending ;RECOVER=1 to the database URL.
@changelog_1266_li
#The Japanese translation of the error messages and the H2 Console has been completed by Masahiro Ikemoto (Arizona Design Inc.)
@changelog_1267_li
#Updates made to updatable rows are now visible within the same result set. DatabaseMetaData.ownUpdatesAreVisible now returns true.
@changelog_1268_li
#ParameterMetaData now returns the correct data for INSERT and UPDATE statements.
@changelog_1269_li
#H2 Shell: DESCRIBE now supports an schema name.
@changelog_1270_li
#A subset of the PostgreSQL 'dollar quoting' feature is now supported.
@changelog_1271_li
#SLF4J is now supported by using adding TRACE_LEVEL_FILE=4 to the database URL.
@changelog_1272_li
#The recovery tool did not work if the table name contained spaces or if there was a comment on the table.
@changelog_1273_li
#Triggers are no longer executed when changing the table structure (ALTER TABLE).
@changelog_1274_li
#When setting BLOB or CLOB values larger than 65 KB using a remote connection, temporary files were kept on the client longer than required (until the connection was closed or the object is garbage collected). Now they are removed as soon as the PreparedStatement is closed, or when the value is overwritten.
@changelog_1275_li
#Statements can now be canceled remotely (when using remote connections).
@changelog_1276_li
#The Shell tool now uses java.io.Console to read the password when using JDK 1.6
@changelog_1277_li
#When using read-only databases and setting LOG=2, an exception was written to the trace file when closing the database. Fixed.
@changelog_1278_h2
#Version 1.0.71 (2008-04-25)
@changelog_1279_li
#H2 is now dual-licensed under the Eclipse Public License (EPL) and the old 'H2 License' (which is basically MPL).
@changelog_1280_li
#Sometimes an exception 'File ID mismatch' or 'try to add a record twice' occurred after large records (8 KB or larger) are updated or deleted. See also http://code.google.com/p/h2database/issues/detail?id=22
@changelog_1281_li
#H2 Console: The tools can now be translated (it didn't work in the last release).
@changelog_1282_li
#New traditional Chinese translation. Thanks a lot to Derek Chao!
@changelog_1283_li
#Indexes were not used when enabling the optimization for IN(SELECT...) (system property h2.optimizeInJoin).
@changelog_1284_h2
#Version 1.0.70 (2008-04-20)
@changelog_1285_li
#The plan is to dual-license H2. The additional license is EPL (Eclipse Public License). The current license (MPL, Mozilla Public License) will stay. Current users are not affected because they can keep MPL. EPL is very similar to MPL, the only bigger difference is related to patents (EPL is a bit more business friendly in this regard). See also http://opensource.org/licenses/eclipse-1.0.php, http://www.eclipse.org/legal/eplfaq.php (FAQ), http://blogs.zdnet.com/Burnette/?p=131
@changelog_1286_li
#Multi version concurrency (MVCC): when a row was updated, and the updated column was not indexed, this update was visible sometimes for other sessions even if it was not committed.
@changelog_1287_li
#Calling SHUTDOWN on one connection and starting a query on another connection concurrently could result in a Java level deadlock.
@changelog_1288_li
#New system property h2.enableAnonymousSSL (default: true) to enable anonymous SSL connections.
@changelog_1289_li
#The precision if SUBSTR is now calculated if possible.
@changelog_1290_li
#The autocomplete in the H2 Console has been improved a bit.
@changelog_1291_li
#The tools in the H2 Console are now translatable.
@changelog_1292_li
#The servlet and lucene jar files are now automatically downloaded when building.
@changelog_1293_li
#The code switch tool has been replaced by a simpler tool called SwitchSource that just uses find and replace.
@changelog_1294_li
#Started to write a Ant replacement ('JAnt') that uses pure Java build definitions. Advantages: ability to debug the build, extensible, flexible, no XML, a bit faster. Future plan: support creating custom h2 distributions (for embedded use). Maybe create a new project 'Jant' or 'Javen' if other people are interested.
@changelog_1295_li
#The jar file is now about 10% smaller because the variable debugging info is no longer included. The source file and line number debugging info is still included. If required, the jar file size of the full version can be further reduced to about 720 KB using 'build jarSmall' or even more by removing unneeded components.
@changelog_1296_li
#Added shell scripts run.sh and build.sh. chmod +x is required, but otherwise it should work. Feedback or improvements are welcome!
@changelog_1297_li
#Databases in zip files: large queries are now supported. Temp files are created in the temp directory if required. The documentation how to create the zip file has been corrected.
@changelog_1298_li
#Invalid inline views threw confusing SQL exceptions.
@changelog_1299_li
#The Japanese translation of the error messages and the H2 Console has been improved. Thanks a lot to Masahiro IKEMOTO.
@changelog_1300_li
#Optimization for MIN() and MAX() when using MVCC.
@changelog_1301_li
#To protect against remote brute force password attacks, the delay after each unsuccessful login now gets double as long. New system properties h2.delayWrongPasswordMin and h2.delayWrongPasswordMax.
@changelog_1302_li
#After setting the query timeout and then resetting it, the next query would still timeout. Fixed.
@changelog_1303_li
#Adding a IDENTITY column to a table with data threw a lock timeout.
@changelog_1304_li
#OutOfMemoryError could occur when using EXISTS or IN(SELECT ..).
@changelog_1305_li
#The built-in connection pool is not called JdbcConnectionPool. The API and documentation has been changed.
@changelog_1306_li
#The ConvertTraceFile tool now generates SQL statement statistics at the end of the SQL script file (similar to the profiling data generated when using java -Xrunhprof).
@changelog_1307_li
#Nested joins are now supported (A JOIN B JOIN C ON .. ON ..)
@changelog_1308_h2
#Version 1.0.69 (2008-03-29)
@changelog_1309_li
#Most command line tools can now be called from within the H2 Console.
@changelog_1310_li
#A new Shell tools is now included (org.h2.tools.Shell) to query a database from the command line.
@changelog_1311_li
#The command line options in the tools have changed: instead of '-log true' now '-trace' is used. Also, '-ifExists', '-tcpSSL' and '-tcpAllowOthers' and so on have changed: now the 'true' is no longer needed. The old behavior is still supported.
@changelog_1312_li
#New system property h2.sortNullsHigh to invert the default sorting behavior for NULL. The default didn't change.
@changelog_1313_li
#Performance was very slow when using LOG=2 and deleting or updating all rows of a table in a loop. Fixed.
@changelog_1314_li
#ALTER TABLE or CREATE TABLE now support parameters for the password field.
@changelog_1315_li
#The linear hash has been removed. It was always slower than the b-tree index, and there were some bugs that would be hard to fix.
@changelog_1316_li
#TRACE_LEVEL_ settings are no longer persistent. This was a problem when database initialization code caused a lot of trace output.
@changelog_1317_li
#Fulltext search (native implementation): The words table is no longer an in-memory table because this caused memory problems in some cases.
@changelog_1318_li
#It was possible to create a role with the name as an existing user (but not vice versa). This is not allowed any more.
@changelog_1319_li
#The recovery tool didn't work correctly for tables without rows.
@changelog_1320_li
#For years below 1, the YEAR method didn't return the correct value, and the conversion from date and timestamp to varchar was incorrect.
@changelog_1321_li
#CSVWRITE caused a NullPointerException when not specifying a nullString.
@changelog_1322_li
#When a log file switch occurred just after a truncate table or drop table statement, the database could not be started normally (RECOVER=1 was required). Fixed.
@changelog_1323_li
#When a log file switch occurred in the middle of a sequence flush (sequences are only flushed every 32 values by default), the sequence value was lost. Fixed.
@changelog_1324_li
#Altering a sequence didn't unlock the system table when autocommit switched off.
@changelog_1325_h2
#Version 1.0.68 (2008-03-18)
@changelog_1326_li
#Very large SELECT DISTINCT and UNION EXCEPT queries are now supported, however this feature is disabled by default. To enable it, set the system property h2.maxMemoryRowsDistinct to a lower value, for example 10000.
@changelog_1327_li
#A error is now thrown when trying to call a method inside a trigger that implicitly commits the current transaction, if an object is locked.
@changelog_1328_li
#Unused LOB files were deleted much too late. Now they are deleted if no longer referenced in memory.
@changelog_1329_li
#ALTER SEQUENCE and ALTER TABLE ALTER COLUMN RESTART can now be used inside a transaction.
@changelog_1330_li
#New system property h2.aliasColumnName. When enabled, aliased columns (as in SELECT ID AS I FROM TEST) return the real table and column name in ResultSetMetaData.getTableName() and getColumnName(). This is disabled by default for compatibility with other databases (HSQLDB, Apache Derby, PostgreSQL, some version of MySQL). In version 1.1 this setting will be enabled.
@changelog_1331_li
#When using encrypted databases, and using the wrong file password, the log file was renamed if the database was not already open. Fixed.
@changelog_1332_li
#Improved performance when using lob files in directories (however this is still disabled by default)
@changelog_1333_li
#H2 Console: autocomplete didn't work with very large scripts. Fixed.
@changelog_1334_li
#Fulltext search: new method SEARCH_DATA that returns the column names and primary keys as arrays.
@changelog_1335_li
#New experimental optimization for GROUP BY queries if an index can be used that matches the group by columns. To enable this optimization, set the system property h2.optimizeGroupSorted to true.
@changelog_1336_li
#When using multi-version concurrency (MVCC=TRUE), duplicate rows could appear in the result set when running queries with uncommitted changes in the same session.
@changelog_1337_li
#H2 Console: remote connections were very slow because getHostName/getRemoteHost was used. Fixed (now using getHostAddress/getRemoteAddr.
@changelog_1338_li
#H2 Console: on Linux, Firefox, Konqueror, or Opera (in this order) are now started if available. This has been tested on Ubuntu.
@changelog_1339_li
#H2 Console: the start window works better with IKVM
@changelog_1340_li
#H2 Console: improved compatibility with Safari (Safari requires keep-alive)
@changelog_1341_li
#Random: the process didn't stop if generating the random seed using the standard way (SecureRandom.generateSeed) was very slow. Now using a daemon thread to avoid this problem.
@changelog_1342_li
#SELECT UNION with a different number of ORDER BY columns did throw an ArrayIndexOutOfBoundsException.
@changelog_1343_li
#When using a view, the column precision was changed to the default scale for some data types.
@changelog_1344_li
#CSVWRITE now supports a 'null string' that is used for parsing and writing NULL.
@changelog_1345_li
#Some long running queries could not be canceled.
@changelog_1346_li
#Queries with many outer join tables were very slow. Fixed.
@changelog_1347_li
#The performance of text comparison has been improved when using locale sensitive string comparison (SET COLLATOR). Now CollationKey is used with a LRU cache. The default cache size is 10000, and can be changed using the system property h2.collatorCacheSize. Use 0 to disable the cache.
@changelog_1348_li
#UPDATE SET column=DEFAULT is now supported.
@changelog_1349_h2
#Version 1.0.67 (2008-02-22)
@changelog_1350_li
#New function FILE_READ to read a file or from an URL. Both binary and text data is supported.
@changelog_1351_li
#CREATE TABLE AS SELECT now supports specifying the column list and data types.
@changelog_1352_li
#Connecting to a TCP server and at shutting it down at the same time could cause a Java level deadlock.
@changelog_1353_li
#A user now has all rights on his own local temporary tables.
@changelog_1354_li
#The CSV tool now supports a custom lineSeparator.
@changelog_1355_li
#When using multiple connections, empty space was reused too early sometimes. This could corrupt the database when recovering.
@changelog_1356_li
#The H2 Console has been translated to Dutch. Thanks a lot to Remco Schoen!
@changelog_1357_li
#Databases can now be opened even if trigger classes are not in the classpath. The exception is thrown when trying to fire the trigger.
@changelog_1358_li
#Opening databases with ACCESS_MODE_DATA=r is now supported. In this case the database is read-only, but the files don't not need to be read-only.
@changelog_1359_li
#Security: The database now waits 200 ms before throwing an exception if the user name or password don't match, to slow down dictionary attacks.
@changelog_1360_li
#The value cache is now a soft reference cache. This should help save memory.
@changelog_1361_li
#CREATE INDEX on a table with many rows could run out of memory. Fixed.
@changelog_1362_li
#Large result sets are now a bit faster.
@changelog_1363_li
#ALTER TABLE ALTER COLUMN RESTART and ALTER SEQUENCE now support parameters (any expressions).
@changelog_1364_li
#When setting the base directory on the command line, the user directory prefix ('~') was ignored.
@changelog_1365_li
#The DbStarter servlet didn't start the TCP listener even if configured.
@changelog_1366_li
#Statement.setQueryTimeout() is now supported.
@changelog_1367_li
#New session setting QUERY_TIMEOUT, and new system property h2.maxQueryTimeout.
@changelog_1368_li
#Changing the transaction log level (SET LOG) is now written to the trace file by default.
@changelog_1369_li
#In a SQL script, primary key constraints are now ordered before foreign key constraints.
@changelog_1370_li
#It was not possible to create a referential constraint to a table in a different schema in some situations.
@changelog_1371_li
#The H2 Console was slow when the database contains many tables. Now the column names are not shown in this case.
@changelog_1372_h2
#Version 1.0.66 (2008-02-02)
@changelog_1373_li
#There is a new online error analyzer tool.
@changelog_1374_li
#H2 Console: stack traces are now links to the source code in the source repository (H2 database only).
@changelog_1375_li
#CHAR data type equals comparison was case insensitive instead of case sensitive.
@changelog_1376_li
#The exception 'Value too long for column' now includes the data.
@changelog_1377_li
#The table name was missing in the documentation of CREATE INDEX.
@changelog_1378_li
#Better support for IKVM (www.ikvm.net): the H2 Console now opens a browser window.
@changelog_1379_li
#The cache size was not correctly calculated for tables with large objects (specially if compression is used). This could lead to out-of-memory exceptions.
@changelog_1380_li
#The exception "Hexadecimal string contains non-hex character" was not always thrown when it should have been. Fixed.
@changelog_1381_li
#The H2 Console now provides a link to the documentation when an error occurs (H2 databases only so far).
@changelog_1382_li
#The acting as PostgreSQL server, when a base directory was set, and the H2 Console was started as well, the base directory was applied twice.
@changelog_1383_li
#Calling EXTRACT(HOUR FROM ...) or EXTRACT(HH FROM ...) returned the wrong values (0 to 11 instead of 0 to 23). All other tested databases return values from 0 to 23. Please check if your application relies on the old behavior before upgrading.
@changelog_1384_li
#For compatibility with other databases the column default (COLUMN_DEF) for columns without default is now null (it was an empty string).
@changelog_1385_li
#Statements that contain very large subqueries (where the subquery result does not fit in memory) are now faster.
@changelog_1386_li
#Variables: large objects (CLOB and BLOB) that don't fit in memory did not work correctly when used as variables.
@changelog_1387_li
#Fulltext search is now supported in named in-memory databases.
@changelog_1388_li
#H2 Console: multiple consecutive spaces in the setting name did not work. Fixed.
@download_1000_h1
ダウンロード
@download_1001_h3
#Version 1.1.108 (2009-02-28)
@download_1002_a
Windows Installer
@download_1003_a
Platform-Independent Zip
@download_1004_h3
#Version 1.0.79 (2008-09-26, Last Stable)
@download_1005_a
Windows Installer
@download_1006_a
Platform-Independent Zip
@download_1007_h3
#Download Mirror and Older Versions
@download_1008_a
Platform-Independent Zip
@download_1009_h3
サブバージョンのソースリポジトリ
@download_1010_a
Google Code
@download_1011_p
#For details about changes, see the Change Log .
@faq_1000_h1
F A Q
@faq_1001_a
#Are there Known Bugs? When is the Next Release?
@faq_1002_a
このデータベースエンジンはオープンソースですか?
@faq_1003_a
#My Query is Slow
@faq_1004_a
新規データベースの構築方法は?
@faq_1005_a
データベースへの接続方法は?
@faq_1006_a
データベースのファイルはどこに保存されますか?
@faq_1007_a
#What is the Size Limit (Maximum Size) of a Database?
@faq_1008_a
これは信頼できるデータベースですか?
@faq_1009_a
#Why is Opening my Database Slow?
@faq_1010_a
#Is the GCJ Version Stable? Faster?
@faq_1011_a
このプロジェクトの翻訳方法は?
@faq_1012_h3
#Are there Known Bugs? When is the Next Release?
@faq_1013_p
#Usually, bugs get fixes as they are found. There is a release every few weeks. Here is the list of known and confirmed issues:
@faq_1014_li
#Tomcat and Glassfish 3 set most static fields (final or non-final) to null when unloading a web application. This can cause a NullPointerException in H2 versions 1.1.107 and older, and may still not work in newer versions. Please report it if you run into this issue. In Tomcat >= 6.0 this behavior can be disabled by setting the system property org.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES to false, however Tomcat may then run out of memory. A known workaround is to put the h2.jar file in a shared lib
directory (common/lib).
@faq_1015_li
#Some problems have been found with right outer join. Internally, it is converted to left outer join, which does not always produce the same results as other databases when used in combination with other joins.
@faq_1016_li
#When using Install4j before 4.1.4 on Linux and enabling 'pack200', the h2*.jar becomes corrupted by the install process, causing application failure. A workaround is to add an empty file h2*.jar.nopack next to the h2*.jar file. This problem is solved in Install4j 4.1.4.
@faq_1017_h3
このデータベースエンジンはオープンソースですか?
@faq_1018_p
はい、H2DBはフリーウェアであり、再配布も可能です。ソースコードも含まれています。ライセンスページも合わせてご確認ください。
@faq_1019_h3
#My Query is Slow
@faq_1020_p
SELECT (または DELETE、UPDATE、MERGE) ステートメント実行に時間がかかるのはいくつかの理由が考えられます。以下のチェックリストをご確認ください:
@faq_1021_li
#Run ANALYZE (see documentation for details).
@faq_1022_li
クエリにEXPLAINオプションを付けて実行し、インデックスが利用されているかどうか確認する (詳細はドキュメントをご覧下さい)
@faq_1023_li
必要に応じてインデックスを追加し、ANALYZE、EXPLAINオプションを用いて再度クエリを実行する
@faq_1024_li
それでも解決しない場合は、ご連絡ください
@faq_1025_h3
新規データベースの構築方法は?
@faq_1026_p
データベースがまだ存在しない場合、デフォルト設定では自動的に新規作成されます
@faq_1027_h3
データベースへの接続方法は?
@faq_1028_p
データベースドライバは org.h2.Driver
で、データベースURLは jdbc:h2:
で始まります。JDBCを利用してデータベースに接続する場合は、以下のコードを利用して下さい:
@faq_1029_h3
データベースのファイルはどこに保存されますか?
@faq_1030_p
#When using database URLs like jdbc:h2:~/test, the database is stored in the user directory. For Windows, this is usually C:\Documents and Settings\<userName>. If the base directory is not set (as in jdbc:h2:test), the database files are stored in the directory where the application is started (the current working directory). When using the H2 Console application from the start menu, this is [Installation Directory]/bin. The base directory can be set in the database URL. A fixed or relative path can be used. When using the URL jdbc:h2:file:data/sample, the database is stored in the directory data (relative to the current working directory). The directory is created automatically if it does not yet exist. It is also possible to use the fully qualified directory (and for Windows, drive) name. Example: jdbc:h2:file:C:/data/test
@faq_1031_h3
#What is the Size Limit (Maximum Size) of a Database?
@faq_1032_p
理論上のデータの制限は現在256GBです。これはBLOBとCLOBデータを含まない状態での値です: BLOB、CLOBの最大値はそれぞれ256GB以上の設定が可能です。インデックスデータのサイズ制限も同様に256GBです。
@faq_1033_p
#The maximum number of rows per table is 2'147'483'648.
@faq_1034_p
FAT、FAT32ファイルシステムの最大ファイルサイズは4GBです。よって、FATやFAT32を利用する場合は、データの制限は4GBということになります。
@faq_1035_p
#The larger the database, the more main memory is required. Currently the minimum main memory required for a 12 GB database is around 240 MB.
@faq_1036_h3
これは信頼できるデータベースですか?
@faq_1037_p
#That is not easy to say. It is still a quite new product. A lot of tests have been written, and the code coverage of these tests is very high. Randomized stress tests are run regularly. But as this is a relatively new product, there are probably some problems that have not yet been found (as with most software). Some features are known to be dangerous by design, and some problems are hard to solve. Those are:
@faq_1038_li
#Using SET LOG 0 to disable the transaction log file.
@faq_1039_li
#Using the transaction isolation level READ_UNCOMMITTED (LOCK_MODE 0) while at the same time using multiple connections may result in inconsistent transactions.
@faq_1040_li
#Using FILE_LOCK=NO in the database URL.
@faq_1041_p
#In addition to that, running out of memory should be avoided. In some versions, OutOfMemory errors while using the database could corrupt a databases. Not all such problems may be fixed.
@faq_1042_p
#Areas that are not fully tested:
@faq_1043_li
#Platforms other than Windows XP or Linux, or JVMs other than Sun 1.4 - 1.6
@faq_1044_li
#The features AUTO_SERVER and AUTO_RECONNECT
@faq_1045_li
#The MVCC (multi version concurrency) mode
@faq_1046_li
#Cluster mode, 2-phase commit, savepoints
@faq_1047_li
#24/7 operation
@faq_1048_li
#Some operations on databases larger than 500 MB may be slower than expected
@faq_1049_li
#Multi-threading and using multiple connections
@faq_1050_li
#The optimizer may not always select the best plan
@faq_1051_p
試験的に考慮された箇所は以下の通り:
@faq_1052_li
#The PostgreSQL server
@faq_1053_li
他のデータベースとの互換モード (一部の特徴のみ提供される)
@faq_1054_li
#The ARRAY data type and related functionality
@faq_1055_h3
#Why is Opening my Database Slow?
@faq_1056_p
#If it takes a long time to open a database, in most cases it was not closed the last time. This is specially a problem for larger databases. To close a database, close all connections to it before the application ends, or execute the command SHUTDOWN. The database is also closed when the virtual machine exits normally by using a shutdown hook. However killing a Java process or calling Runtime.halt will prevent this.
@faq_1057_p
#To find out what the problem is, open the database in embedded mode using the H2 Console. This will print progress information. If you have many 'Creating index' lines it is an indication that the database was not closed the last time.
@faq_1058_p
#Other possible reasons are: the database is very big (many GB), or contains linked tables that are slow to open.
@faq_1059_h3
#Is the GCJ Version Stable? Faster?
@faq_1060_p
GCJバージョンは、Javaバージョンほどは安定していません。GCJバージョンでリグレッションテストを実行した時、アプリケーションはランダムポイントと思われるところで、エラーメッセージなしで停止する場合があります。現在、GCJバージョンはSun VMの使用時よりも低速です。しかし、GCJバージョンの起動はVM使用時よりも高速です。
@faq_1061_h3
このプロジェクトの翻訳方法は?
@faq_1062_p
#For more information, see Build/Translating .
@features_1000_h1
特徴
@features_1001_a
特徴一覧
@features_1002_a
#Limitations
@features_1003_a
他のデータベースエンジンと比較する
@features_1004_a
#H2 in Use
@features_1005_a
接続モード
@features_1006_a
データベースURL概要
@features_1007_a
エンベッド (ローカル) データベースに接続
@features_1008_a
メモリオンリーデータベース
@features_1009_a
暗号化ファイルと共にデータベースへ接続する
@features_1010_a
データベースファイルロック
@features_1011_a
すでに存在する場合のみ、データベースを開く
@features_1012_a
データベースを終了する
@features_1013_a
未知の設定を無視
@features_1014_a
接続が開始された時に他の設定を変更する
@features_1015_a
ログインデックスの修正
@features_1016_a
カスタムファイル アクセスモード
@features_1017_a
複数の接続
@features_1018_a
データベースファイルレイアウト
@features_1019_a
ログとリカバリー
@features_1020_a
互換性
@features_1021_a
#Auto-Reconnect
@features_1022_a
#Automatic Mixed Mode
@features_1023_a
トレースオプションを使用する
@features_1024_a
#Using Other Logging APIs
@features_1025_a
読み取り専用データベース
@features_1026_a
#Read Only Databases in Zip or Jar File
@features_1027_a
ディスクスペースが少ない状況での正しい取り扱い
@features_1028_a
computed column / ベースインデックスの機能
@features_1029_a
多次元インデックス
@features_1030_a
パスワードを使用する
@features_1031_a
ユーザー定義の関数とストアドプロシージャ
@features_1032_a
トリガー
@features_1033_a
データベースをコンパクトにする
@features_1034_a
キャッシュの設定
@features_1035_h2
特徴一覧
@features_1036_h3
主な特徴
@features_1037_li
非常に高速なデータベースエンジン
@features_1038_li
無料、ソースコード付き
@features_1039_li
Javaで記載
@features_1040_li
標準規格のSQL、JDBC APIをサポート
@features_1041_li
エンベッドモードとサーバーモード、クラスタリングをサポート
@features_1042_li
強力なセキュリティ機能
@features_1043_li
#The PostgreSQL ODBC driver can be used
@features_1044_li
#Multi version concurrency
@features_1045_h3
追加された特徴
@features_1046_li
ディスクベースデータベース、またはインメモリデータベースと、テーブル、読み取り専用データベースをサポート、テンポラリテーブル
@features_1047_li
トランザクションをサポート (トランザクション分離の serializable (直列化))、2フェーズコミット
@features_1048_li
複数の接続、テーブルレベルのロック
@features_1049_li
コストベースオプティマイザ、複雑なクエリーのために遺伝的アルゴリズムを使用、zero-administration
@features_1050_li
スクロール可能result setと更新可能result setをサポート、大きなresult set、外部結果ソート、 関数はresult setを返す
@features_1051_li
暗号化されたデータベース (AES または XTEA), SHA-256 パスワード暗号化、暗号化関数、SSL
@features_1052_h3
SQLサポート
@features_1053_li
複数のスキーマ、インフォメーションスキーマをサポート
@features_1054_li
参照整合性 / カスケードでの外部キー制約、チェック制約
@features_1055_li
内部結合と外部結合、サブクエリー、読み取り専用ビューとインラインビュー
@features_1056_li
トリガーと Java関数 / ストアドプロシージャ
@features_1057_li
多数の組み込み関数、XMLとlossless data compression (可逆圧縮) を含む
@features_1058_li
大きなオブジェクト (BLOB/CLOB) とArrayを含む、広い範囲のデータ型
@features_1059_li
シーケンスとautoincrement column、computed column、(関数ベースのインデックスに使用できます)
@features_1060_li
ORDER BY, GROUP BY, HAVING, UNION, LIMIT, TOP
@features_1061_li
Collationをサポート、users、roles
@features_1062_li
#Compatibility modes for IBM DB2, Apache Derby, HSQLDB, MS SQL Server, MySQL, Oracle, and PostgreSQL.
@features_1063_h3
セキュリティの特徴
@features_1064_li
SQLインジェクション問題の解決を含む
@features_1065_li
SHA-256とsaltを使ってユーザーパスワードが本物であることを証明する
@features_1066_li
ユーザーパスワードは決してプレーンテキストでネットワーク上に送信されることはない (たとえ不安定な接続を使用していたとしても)
@features_1067_li
AES-256とXTEA暗号化アルゴリズムを使用することで、全てのデータベースファイル (データのバックアップを取るのに使用できるスクリプトファイルを含む) を暗号化できる
@features_1068_li
リモートJDBCドライバは、SSL/TLS上のTCP/IP接続をサポート
@features_1069_li
組み込みwebサーバーは、SSL/TLS上の接続をサポート
@features_1070_li
Stringの代わりにchar arrayを使うことで、パスワードをデータベースに送信可能
@features_1071_h3
他の特徴とツール
@features_1072_li
省スペース (1MBより小さい)、少ないメモリが必要条件
@features_1073_li
#Multiple index types (b-tree, tree, hash)
@features_1074_li
多次元のインデックスをサポート
@features_1075_li
CSV (comma separated values) ファイルサポート
@features_1076_li
リンクテーブルと組み込み仮想 "range" テーブルのサポート
@features_1077_li
EXPLAIN PLANをサポート、 洗練されたトレースオプション
@features_1078_li
パフォーマンスを向上させるために、データベースの終了を遅らせるか割り込みを抑制する
@features_1079_li
Webベースのコンソールアプリケーション (英語、ドイツ語、部分的にフランス語とスペイン語) が自動完備
@features_1080_li
データベースはSQLスクリプトファイルを生成
@features_1081_li
データファイルのコンテンツを移動することができるリカバリーツールを含む
@features_1082_li
#Support for variables (for example to calculate running totals)
@features_1083_li
prepared statementの自動再編集
@features_1084_li
#Uses a small number of database files
@features_1085_li
各レコードのためのチェックサムと、データ整合性のためのログエントリーを使用
@features_1086_li
十分なテスト済み (高いコードカバー率、ランダムストレステスト)
@features_1087_h2
#Limitations
@features_1088_p
#For the list of limitations, please have a look at the road map page at: http://www.h2database.com/html/roadmap.html
@features_1089_h2
他のデータベースエンジンと比較する
@features_1090_th
特徴
@features_1091_th
H2
@features_1092_th
Derby
@features_1093_th
HSQLDB
@features_1094_th
MySQL
@features_1095_th
PostgreSQL
@features_1096_td
Pure Java
@features_1097_td
対応
@features_1098_td
対応
@features_1099_td
対応
@features_1100_td
非対応
@features_1101_td
非対応
@features_1102_td
エンベッドモード (Java)
@features_1103_td
対応
@features_1104_td
対応
@features_1105_td
対応
@features_1106_td
非対応
@features_1107_td
非対応
@features_1108_td
パフォーマンス (エンベッド)
@features_1109_td
速い
@features_1110_td
遅い
@features_1111_td
速い
@features_1112_td
該当なし
@features_1113_td
該当なし
@features_1114_td
#In-Memory Mode
@features_1115_td
対応
@features_1116_td
非対応
@features_1117_td
対応
@features_1118_td
非対応
@features_1119_td
非対応
@features_1120_td
トランザクション分離
@features_1121_td
対応
@features_1122_td
対応
@features_1123_td
非対応
@features_1124_td
対応
@features_1125_td
対応
@features_1126_td
コストベースオプティマイザ
@features_1127_td
対応
@features_1128_td
対応
@features_1129_td
非対応
@features_1130_td
対応
@features_1131_td
対応
@features_1132_td
クラスタリング
@features_1133_td
対応
@features_1134_td
非対応
@features_1135_td
非対応
@features_1136_td
対応
@features_1137_td
対応
@features_1138_td
暗号化データベース
@features_1139_td
対応
@features_1140_td
対応
@features_1141_td
非対応
@features_1142_td
非対応
@features_1143_td
非対応
@features_1144_td
リンクテーブル
@features_1145_td
対応
@features_1146_td
非対応
@features_1147_td
#Partially *1
@features_1148_td
#Partially *2
@features_1149_td
非対応
@features_1150_td
ODBCドライバ
@features_1151_td
対応
@features_1152_td
非対応
@features_1153_td
非対応
@features_1154_td
対応
@features_1155_td
対応
@features_1156_td
フルテキストサーチ
@features_1157_td
対応
@features_1158_td
非対応
@features_1159_td
非対応
@features_1160_td
対応
@features_1161_td
対応
@features_1162_td
#User-Defined Datatypes
@features_1163_td
対応
@features_1164_td
非対応
@features_1165_td
非対応
@features_1166_td
対応
@features_1167_td
対応
@features_1168_td
データベースごとのファイル
@features_1169_td
少
@features_1170_td
多
@features_1171_td
少
@features_1172_td
多
@features_1173_td
多
@features_1174_td
テーブルレベルロック
@features_1175_td
対応
@features_1176_td
対応
@features_1177_td
非対応
@features_1178_td
対応
@features_1179_td
対応
@features_1180_td
#Row Level Locking
@features_1181_td
#Yes *9
@features_1182_td
対応
@features_1183_td
非対応
@features_1184_td
対応
@features_1185_td
対応
@features_1186_td
#Multi Version Concurrency
@features_1187_td
対応
@features_1188_td
非対応
@features_1189_td
非対応
@features_1190_td
非対応
@features_1191_td
対応
@features_1192_td
#Role Based Security
@features_1193_td
対応
@features_1194_td
#Yes *3
@features_1195_td
対応
@features_1196_td
対応
@features_1197_td
対応
@features_1198_td
#Updatable Result Sets
@features_1199_td
対応
@features_1200_td
#Yes *7
@features_1201_td
非対応
@features_1202_td
対応
@features_1203_td
対応
@features_1204_td
#Sequences
@features_1205_td
対応
@features_1206_td
非対応
@features_1207_td
対応
@features_1208_td
非対応
@features_1209_td
対応
@features_1210_td
#Limit and Offset
@features_1211_td
対応
@features_1212_td
非対応
@features_1213_td
対応
@features_1214_td
対応
@features_1215_td
対応
@features_1216_td
#Temporary Tables
@features_1217_td
対応
@features_1218_td
#Yes *4
@features_1219_td
対応
@features_1220_td
対応
@features_1221_td
対応
@features_1222_td
#Information Schema
@features_1223_td
対応
@features_1224_td
#No *8
@features_1225_td
#No *8
@features_1226_td
対応
@features_1227_td
対応
@features_1228_td
#Computed Columns
@features_1229_td
対応
@features_1230_td
非対応
@features_1231_td
非対応
@features_1232_td
非対応
@features_1233_td
#Yes *6
@features_1234_td
#Case Insensitive Columns
@features_1235_td
対応
@features_1236_td
非対応
@features_1237_td
対応
@features_1238_td
対応
@features_1239_td
#Yes *6
@features_1240_td
#Custom Aggregate Functions
@features_1241_td
対応
@features_1242_td
非対応
@features_1243_td
非対応
@features_1244_td
対応
@features_1245_td
対応
@features_1246_td
フットプリント (jar/dll size)
@features_1247_td
#~1 MB *5
@features_1248_td
#~2 MB
@features_1249_td
#~600 KB
@features_1250_td
#~4 MB
@features_1251_td
#~6 MB
@features_1252_p
#*1 HSQLDB supports text tables.
@features_1253_p
#*2 MySQL supports linked MySQL tables under the name 'federated tables'.
@features_1254_p
#*3 Derby support for roles based security and password checking as an option.
@features_1255_p
#*4 Derby only supports global temporary tables.
@features_1256_p
#*5 The default H2 jar file contains debug information, jar files for other databases do not.
@features_1257_p
#*6 PostgreSQL supports functional indexes.
@features_1258_p
#*7 Derby only supports updatable result sets if the query is not sorted.
@features_1259_p
#*8 Derby and HSQLDB don't support standard compliant information schema tables. *9 H2 supports row level locks when using multi version concurrency.
@features_1260_h3
DerbyとHSQLDB
@features_1261_p
#After an unexpected process termination (for example power failure), H2 can recover safely and automatically without any user interaction. For Derby and HSQLDB, some manual steps are required ('Another instance of Derby may have already booted the database' / 'The database is already in use by another process').
@features_1262_h3
DaffodilDbとOne$Db
@features_1263_p
このデータベースの開発は止まっているようです。最後のリリースは2006年2月でした。
@features_1264_h3
McKoi
@features_1265_p
このデータベースの開発は止まっているようです。最後のリリースは2004年8月でした。
@features_1266_h2
#H2 in Use
@features_1267_p
#For a list of applications that work with or use H2, see: Links .
@features_1268_h2
接続モード
@features_1269_p
以下の接続モードがサポートされています:
@features_1270_li
#Embedded mode (local connections using JDBC)
@features_1271_li
#Remote mode (remote connections using JDBC or ODBC over TCP/IP)
@features_1272_li
#Mixed mode (local and remote connections at the same time)
@features_1273_h3
エンベッドモード
@features_1274_p
#In embedded mode, an application opens a database from within the same JVM using JDBC. This is the fastest and easiest connection mode. The disadvantage is that a database may only be open in one virtual machine (and class loader) at any time. As in all modes, both persistent and in-memory databases are supported. There is no limit on the number of database open concurrently, or on the number of open connections.
@features_1275_h3
#Remote Mode
@features_1276_p
#When using the remote mode (sometimes called server mode or client/server mode), an application opens a database remotely using the JDBC or ODBC API. A server needs to be started within the same or another virtual machine (or on another computer). Many applications can connect to the same database at the same time. The remote mode is slower than the embedded mode, because all data is transferred over TCP/IP. As in all modes, both persistent and in-memory databases are supported. There is no limit on the number of database open concurrently, or on the number of open connections.
@features_1277_h3
#Mixed Mode
@features_1278_p
#The mixed mode is a combination of the embedded and the remote mode. The first application that connects to a database does that in embedded mode, but also starts a server so that other applications (running in different processes or virtual machines) can concurrently access the same data. The embedded connections are as fast as if the database is used in just the embedded mode, while the remote connections are a bit slower. All clients that want to connect to the database (no matter if it's an embedded or remote connection) can do so using the exact same database URL.
@features_1279_h2
データベースURL概要
@features_1280_p
#This database supports multiple connection modes and connection settings. This is achieved using different database URLs. Settings in the URLs are not case sensitive.
@features_1281_th
トピック
@features_1282_th
URLフォーマットと例
@features_1283_a
エンベッド (ローカル) 接続
@features_1284_td
jdbc:h2:[file:][<path>]<databaseName>
@features_1285_td
jdbc:h2:~/test
@features_1286_td
jdbc:h2:file:/data/sample
@features_1287_td
jdbc:h2:file:C:/data/sample (Windowsのみ)
@features_1288_a
インメモリ (プライベート)
@features_1289_td
jdbc:h2:mem:
@features_1290_a
インメモリ (名付ける)
@features_1291_td
jdbc:h2:mem:<databaseName>
@features_1292_td
jdbc:h2:mem:test_mem
@features_1293_a
TCP/IPを使用したリモート
@features_1294_td
jdbc:h2:tcp://<server>[:<port>]/<databaseName>
@features_1295_td
#jdbc:h2:tcp://localhost/~/test
@features_1296_td
#jdbc:h2:tcp://dbserv:8084/~/sample
@features_1297_a
SSL/TLSを使用したリモート
@features_1298_td
jdbc:h2:ssl://<server>[:<port>]/<databaseName>
@features_1299_td
#jdbc:h2:ssl://secureserv:8085/~/sample;
@features_1300_a
暗号化ファイルの使用
@features_1301_td
jdbc:h2:<url>;CIPHER=[AES|XTEA]
@features_1302_td
#jdbc:h2:ssl://secureserv/~/testdb;CIPHER=AES
@features_1303_td
jdbc:h2:file:~/secure;CIPHER=XTEA
@features_1304_a
ファイルロックメソッド
@features_1305_td
jdbc:h2:<url>;FILE_LOCK={NO|FILE|SOCKET}
@features_1306_td
jdbc:h2:file:~/quickAndDirty;FILE_LOCK=NO
@features_1307_td
jdbc:h2:file:~/private;CIPHER=XTEA;FILE_LOCK=SOCKET
@features_1308_a
すでに存在する場合は起動のみ
@features_1309_td
jdbc:h2:<url>;IFEXISTS=TRUE
@features_1310_td
jdbc:h2:file:~/sample;IFEXISTS=TRUE
@features_1311_a
VMが終了した時、データベースを終了しない
@features_1312_td
jdbc:h2:<url>;DB_CLOSE_ON_EXIT=FALSE
@features_1313_a
ユーザー名、及びパスワード
@features_1314_td
jdbc:h2:<url>[;USER=<username>][;PASSWORD=<value>]
@features_1315_td
jdbc:h2:file:~/sample;USER=sa;PASSWORD=123
@features_1316_a
ログインデックスの修正
@features_1317_td
jdbc:h2:<url>;LOG=2
@features_1318_td
jdbc:h2:file:~/sample;LOG=2
@features_1319_a
デバックトレースの設定
@features_1320_td
jdbc:h2:<url>;TRACE_LEVEL_FILE=<level 0..3>
@features_1321_td
jdbc:h2:file:~/sample;TRACE_LEVEL_FILE=3
@features_1322_a
未知の設定を無視
@features_1323_td
jdbc:h2:<url>;IGNORE_UNKNOWN_SETTINGS=TRUE
@features_1324_a
カスタムファイル アクセスモード
@features_1325_td
jdbc:h2:<url>;ACCESS_MODE_LOG=rws;ACCESS_MODE_DATA=rws
@features_1326_a
#Database in or Zip File
@features_1327_td
#jdbc:h2:zip:<zipFileName>!/<databaseName>
@features_1328_td
#jdbc:h2:zip:~/db.zip!/test
@features_1329_a
#Compatibility Mode
@features_1330_td
#jdbc:h2:<url>;MODE=<databaseType>
@features_1331_td
#jdbc:h2:~/test;MODE=MYSQL
@features_1332_a
#Auto-Reconnect
@features_1333_td
#jdbc:h2:<url>;AUTO_RECONNECT=TRUE
@features_1334_td
#jdbc:h2:tcp://localhost/~/test;AUTO_RECONNECT=TRUE
@features_1335_a
#Automatic Mixed Mode
@features_1336_td
#jdbc:h2:<url>;AUTO_SERVER=TRUE
@features_1337_td
#jdbc:h2:~/test;AUTO_SERVER=TRUE
@features_1338_a
他の設定の変更
@features_1339_td
jdbc:h2:<url>;<setting>=<value>[;<setting>=<value>...]
@features_1340_td
jdbc:h2:file:~/sample;TRACE_LEVEL_SYSTEM_OUT=3
@features_1341_h2
エンベッド (ローカル) データベースに接続
@features_1342_p
#The database URL for connecting to a local database is jdbc:h2:[file:][<path>]<databaseName>
. The prefix file:
is optional. If no or only a relative path is used, then the current working directory is used as a starting point. The case sensitivity of the path and database name depend on the operating system, however it is recommended to use lowercase letters only. The database name must be at least three characters long (a limitation of File.createTempFile). To point to the user home directory, use ~/, as in: jdbc:h2:~/test.
@features_1343_h2
メモリオンリーデータベース
@features_1344_p
特定の使用方法では (例: rapid prototyping、テスト、高パフォーマンスオペレーション、読み取り専用データベース)、データは持続する (変化する) 必要は全くないかもしれません。このデータベースは、データが持続しない際にメモリオンリーモードをサポートします。
@features_1345_p
一部ケースでは、メモリオンリーデータベースへの接続はひとつの接続のみ必要とされます。これは、開かれるデータベースがプライベートだということを意味しています。このケースでは、データベースURLは jdbc:h2:mem:
です。同じ仮想マシン内で二つの接続が開いているというのは、二つの異なった (プライベートの) データベースが開いているという意味です。
@features_1346_p
時々、複数の接続が同じメモリオンリーデータベースを必要とします。このケースでは、データベースのURLに名前が含まれていなければなりません。例: jdbc:h2:mem:db1
この方法での同じデータベースのアクセスは、同じ仮想マシンとClassLoader環境内でのみ動作します。
@features_1347_p
TCP/IPまたは、SSL/TLSを使用して、メモリオンリーデータベースに間接的に (または、同じマシンの複数のプロセスから) 接続することも可能です。データベースURLの例: jdbc:h2:tcp://localhost/mem:db1
(プライベートデータベースを間接的に使用することも可能です)
@features_1348_p
#By default, when the last connection to a in-memory database is closed, the contents are lost. This can be disabled by adding ;DB_CLOSE_DELAY=-1 to the database URL. That means to keep the contents of an in-memory database as long as the virtual machine is alive, use jdbc:h2:mem:test;DB_CLOSE_DELAY=-1
@features_1349_h2
暗号化ファイルと共にデータベースへ接続する
@features_1350_p
ファイルを暗号化して使用するためには、暗号化アルゴリズム ("cipher") とファイルパスワードを指定することが必要です。アルゴリズムは、接続パラメータを使用することで指定される必要があります。二つのアルゴリズムがサポートされています: XTEAとAES です。ファイルパスワードは、ユーザーパスワードの前のパスワードフィールドで指定されます。ファイルパスワードとユーザーパスワードの間に、シングルスペースを加えることが必要です; ファイルパスワードそのものにはスペースは含まれません。ファイルパスワードは (ユーザーパスワードも同様) 大文字と小文字を区別しています。こちらがパスワードの暗号化されたデータベースに接続するための例です:
@features_1351_h2
データベースファイルロック
@features_1352_p
データベースが開かれるときはいつも、データベースが使用中であると他のプロセスに合図するためにロックファイルが作成されます。もしデータベースが閉じられるか、データベースを開いたプロセスが終了するなら、ロックファイルは削除されます。
@features_1353_p
以下のファイルロックメソッドが提供されます:
@features_1354_li
デフォルトメソッドは "file" で、データベースファイルを保護するために、watchdogスレッドを使用します。watchdogは、ロックファイルをそれぞれ秒単位で読み込みます。
@features_1355_li
二つめのメソッドは "socket" で、サーバーソケットを開きます。ソケットメソッドは、ロックファイルを秒単位で読むことを必要としていません。ソケットメソッドは、データベースファイルがひとつの (いつも同じ) コンピューターのみによってアクセスされる場合にのみ使用されます。
@features_1356_li
ファイルロッキングなしでデータベースを開始することも可能です; このケースでは、データベースファイルを保護するのはアプリケーション次第です。
@features_1357_p
異なったファイルロックメソッドでデータベースを開くには、"FILE_LOCK" パラメータを使用します。以下のコードは "socket" ロックメソッドのデータベースを開きます:
@features_1358_p
以下のコードは、データベースにロックファイルを全く作らないよう強要させます。これは、データ破損を導く可能性のある、同じデータベースを開くことができる他のプロセスのように、安全ではないということに注意して下さい:
@features_1359_p
アルゴリズムについての詳しい情報は、進化したトピックス のファイルロックプロトコルをご覧下さい。
@features_1360_h2
すでに存在する場合のみ、データベースを開く
@features_1361_p
デフォルトでは、アプリケーションが DriverManager.getConnection(url,...)
を呼び出し、URLで指定されたデータベースがまだ存在しない時、 新しい (空の) データベースが作成されます。ある状況では、もしすでにデータベースが存在するのであれば、新しいデータベースの作成を制限して、データベースを開くだけにした方がよいでしょう。;ifexists=true
をURLに追加することによって可能になります。このケースでは、もしデータベースがまだ存在していなければ、接続しようとした時に例外が投げられます。接続は、データベースがすでに存在する時のみ成功します。完全なURLは次のようです:
@features_1362_h2
データベースを終了する
@features_1363_h3
データベースの遅延終了
@features_1364_p
通常、データベースへの最後の接続が閉じられた時、データベースが終了されます。一部状況では、例えば、可能ではない時に接続をつなげたままにしておくことは、アプリケーションを減速させます。SQLステートメントの SET DB_CLOSE_DELAY <seconds> でデータベースの自動終了を遅らせるか、または無効にすることができます。secondsには、最後の接続が閉じられた後データベースを接続したままの状態に保つため、秒数を指定します。例えば、次のステートメントはデータベースを10秒間開かれた状態に保ちます:
@features_1365_p
値の-1は、データベースは決して自動的に閉じられないということを意味します。値の0はデフォルトで、最後の接続が終了した時データベースが終了するということを意味します。この設定は永続的で、管理者のみが設定することができます。データベースのURL内で値を設定することが可能です: jdbc:h2:~/test;DB_CLOSE_DELAY=10
@features_1366_h3
VMが終了した時、データベースを終了しない
@features_1367_p
デフォルトでは、データベースは最後の接続が閉じられた時に終了されます。しかし、最後の接続が決して閉じられなければ、仮想マシンが正常に終了する時にデータベースは閉じられます。これはshutdown hookを使うことによって行われます。一部状況では、データベースはこのケースで終了されてはいけません。例えば、仮想マシンが終了している時にデータベースがまだ使われている場合です (例として、シャットダウンプロセスをデータベースに保存するため)。このケースでは、データベースURLでデータベースの自動終了を無効にすることが可能です。最初の接続は (ひとつはデータベースを開始するもの) データベースURLにオプションを設定する必要があります (設定を後で変更することは不可能です)。VMが終了する時、データベースの終了を無効にするためのデータベースURLです:
@features_1368_h2
ログインデックスの修正
@features_1369_p
通常、インデックスファイルの変更はパフォーマンスのために記録されません。データベースを開いた時に、インデックスファイルが破損しているか、無くなっていたら、データから作り直されます。停電、またはプログラムの異常終了のため、データベースが正しく終了されなかった時、インデックスファイルは破損されます。一部状況では、例えば、非常に大きなデータベースを使用している時 (数百MB以上)、インデックスファイルが再作成されるのにはとても時間がかかります。それらの状況では、インデックスファイルの変更を記録しておいた方がよいでしょう。そうすることによって、破損されたインデックスファイルの回復が速くなります。ログインデックスの修正を可能にするためには、jdbc:h2:~/test;LOG=2 のように、URLに LOG=2 を追加して下さい。接続する時に、この設定が指定されます。このオプションを使用する時、データベースのアップデートパフォーマンスは低下するでしょう。
@features_1370_h2
未知の設定を無視
@features_1371_p
データベースに接続する時、いくつかのアプリケーションが (例えば、OpenOffice.org Base) いくつかの追加パラメータを渡します。なぜそれらのパラメータが渡されるのかは知られていません。PREFERDOSLIKELINEENDS と IGNOREDRIVERPRIVILEGES はパラメータの例で、それらは、OpenOffice.orgとの互換性を改良するために単に無視されます。もしデータベースに接続する時、アプリケーションが他のパラメータを渡していたら、通常データベースは、 パラメータはサポートされていません、という例外を投げます。データベースURLに ;IGNORE_UNKNOWN_SETTINGS=TRUE を追加することで、このようなパラメータを無視することが可能です。
@features_1372_h2
接続が開始された時に他の設定を変更する
@features_1373_p
すでに記述された設定に加えて (暗号、ファイルロック、データベースの存在、ユーザー、パスワード)、他のデータベースの設定は、データベースURLの中で渡すことができます。SET setting value
ステートメントを接続直後に実行するのと同じように 、setting=value
をURLの最後に追加します。このデータベースによってサポートされている設定の一覧は、SQL文法のドキュメントをご覧下さい。
@features_1374_h2
カスタムファイル アクセスモード
@features_1375_p
#Usually, the database opens log, data and index files with the access mode 'rw', meaning read-write (except for read only databases, where the mode 'r' is used). To open a database in read-only mode if the files are not read-only, use ACCESS_MODE_DATA=r. Also supported are 'rws' and 'rwd'. The access mode used for log files is set via ACCESS_MODE_LOG; for data and index files use ACCESS_MODE_DATA. These settings must be specified in the database URL:
@features_1376_p
詳細は 永続性問題 をご覧下さい。 多くのオペレーティングシステムでは、アクセスモード "rws" において、データがディスクに書かれていることを保証しません。
@features_1377_h2
複数の接続
@features_1378_h3
同時に複数のデータベースを開く
@features_1379_p
アプリケーションは、同じデータベースへの複数の接続を含め、複数のデータベースを同時に開くことができます。開くデータベースの数は、利用可能なメモリによってのみ制限されています。
@features_1380_h3
>同じデータベースへの複数の接続: クライアント/サーバー
@features_1381_p
異なったプロセス、またはコンピューターから同時に同じデータベースにアクセスしたい場合、クライアント/サーバー モードを使用することが必要です。このケースでは、ひとつのプロセスがサーバーとして動作し、他のプロセスは (同様に他のコンピューターに属することができます) TCP/IP (または改善されたセキュリティ用のTCP/IPの上のSSL/TLS) を通してサーバーに接続します。
@features_1382_h3
マルチスレッドサポート
@features_1383_p
このデータベースは安全なマルチスレッドです。これは、アプリケーションがマルチスレッドならば、データベースへの同時アクセスに関して心配する必要がない、ということを意味しています。本質的に、同じデータベースへのほとんどのリクエストは同時に動きます。アプリケーションは、同時に同じデータベースにアクセスするマルチスレッドを使用することができますが、ひとつのスレッドが処理時間の長いクエリーを実行しているなら、他のスレッドは待つ必要があります。
@features_1384_h3
ロック、ロックタイムアウト、デッドロック
@features_1385_p
データの一貫した状態をそれぞれの接続に与えるために、データベースはテーブルレベルでのロックを使用します。二種類のロックがあります: リードロック (共有ロック) とライトロック (排他ロック) です。もし、接続がテーブルから読み込みたい場合で、テーブルにライトロックがない場合に、リードロックをテーブルに追加します。もしライトロックがあれば、この接続はロックを解除するために他の接続を待ちます。接続が指定された時間までにロックを取得できなければ、ロックタイムアウトの例外が投げられます。
@features_1386_p
通常、SELECTステートメントはリードロックを生成します。これはサブクエリーも含まれます。データを修正するステートメントはライトロックを使用します。SELECT ... FOR UPDATE ステートメントを使用して、データの修正がなくても排他的にテーブルをロックすることも可能です。COMMITとROLLBACKステートメントは全ての周知のロックを解除します。SAVEPOINTとROLLBACK TO SAVEPOINTコマンドはロックに影響を及ぼしません。ロックはオートコミットモードに変更した時、オートコミットの接続がtrueにセットされた時 (この状態がデフォルトです) にも解除され、ロックはそれぞれのステートメントの後に解除されます。これは、どのステートメントでどんな種類のロックが生成されるかの概観です:
@features_1387_th
ロックの種類
@features_1388_th
SQLステートメント
@features_1389_td
Read
@features_1390_td
SELECT * FROM TEST
@features_1391_td
CALL SELECT MAX(ID) FROM TEST
@features_1392_td
SCRIPT
@features_1393_td
Write
@features_1394_td
SELECT * FROM TEST WHERE 1=0 FOR UPDATE
@features_1395_td
Write
@features_1396_td
INSERT INTO TEST VALUES(1, 'Hello')
@features_1397_td
INSERT INTO TEST SELECT * FROM TEST
@features_1398_td
UPDATE TEST SET NAME='Hi'
@features_1399_td
DELETE FROM TEST
@features_1400_td
Write
@features_1401_td
ALTER TABLE TEST ...
@features_1402_td
CREATE INDEX ... ON TEST ...
@features_1403_td
DROP INDEX ...
@features_1404_p
SQLコマンド SET LOCK_TIMEOUT <milliseconds> を使用して、ロックタイムアウトの例外が投げられるまでの秒数を、それぞれの接続ごとに別々に設定することができます。SQLコマンド SET DEFAULT_LOCK_TIMEOUT <milliseconds> を使用して、初期のロックタイムアウト (新しい接続に使用されるタイムアウト) を設定することができます。デフォルトのロックタイムアウトは永続的です。
@features_1405_h2
データベースファイルレイアウト
@features_1406_p
永続的なデータベースのために作成された多くのファイルがあります。一部のデータベースを除いて、全てのテーブルと (または) インデックスが自身のファイル内に保存されているわけではありません。その代りに、通常次のファイルのみが作成されます: データファイル、インデックスファイル、ログファイル、データベースロックファイル (データベースが使われている間のみ存在します)。それに加えて、ファイルはそれぞれの大きなオブジェクト (CLOB/BLOB) のために作成されます。各ライナーインデックスのためのファイル、大きなresult setのためのテンポラリーファイルです。データベーストレースオプションが有効の場合、トレースファイルが作成されます。次のファイルはデータベースによって作成されます:
@features_1407_th
ファイル名
@features_1408_th
説明
@features_1409_th
ファイル数
@features_1410_td
test.data.db
@features_1411_td
データファイル
@features_1412_td
全てのテーブルのデータを含む
@features_1413_td
フォーマット: <database>.data.db
@features_1414_td
データベースごとに1ファイル
@features_1415_td
test.index.db
@features_1416_td
インデックスファイル
@features_1417_td
全ての (btree) インデックスのデータを含む
@features_1418_td
フォーマット: <database>.index.db
@features_1419_td
データベースごとに1ファイル
@features_1420_td
test.0.log.db
@features_1421_td
ログファイル
@features_1422_td
ログファイルはリカバリーのために使われる
@features_1423_td
フォーマット: <database>.<id>.log.db
@features_1424_td
データベースごとに0ファイル以上
@features_1425_td
test.lock.db
@features_1426_td
データベースロックファイル
@features_1427_td
データベースが開かれている時のみ存在
@features_1428_td
フォーマット: <database>.lock.db
@features_1429_td
データベースごとに1ファイル
@features_1430_td
test.trace.db
@features_1431_td
トレースファイル
@features_1432_td
トレース情報を含む
@features_1433_td
フォーマット: <database>.trace.db
@features_1434_td
ファイルが大きすぎる場合、<database>.trace.db.old に改名される
@features_1435_td
データベースごとに1ファイル
@features_1436_td
test.14.15.lob.db
@features_1437_td
大きなオブジェクト
@features_1438_td
BLOB、またはCLOBのデータを含む
@features_1439_td
フォーマット: <database>.<tableid>.<id>.lob.db
@features_1440_td
オブジェクトごとに1ファイル
@features_1441_td
test.123.temp.db
@features_1442_td
テンポラリーファイル
@features_1443_td
テンポラリーblob、または大きなresult setを含む
@features_1444_td
フォーマット: <database>.<session id>.<object id>.temp.db
@features_1445_td
オブジェクトごとに1ファイル
@features_1446_td
test.7.hash.db
@features_1447_td
ハッシュインデックスファイル
@features_1448_td
ライナーハッシュインデックスのデータを含む
@features_1449_td
フォーマット: <database>.<object id>.hash.db
@features_1450_td
ライナーハッシュインデックスごとに1ファイル
@features_1451_h3
データベースファイルの移動と改名
@features_1452_p
データベースの名前と位置は、データベース名の中には保存されません。
@features_1453_p
データベースが閉じられている間、ファイルは他のディレクトリに移動することができ、同様にファイル名を変えることもできます (全てのファイルが同じ名前で始まる必要があります)。
@features_1454_p
ファイルにはプラットホーム固有のデータがないので、問題なく他のオペレーティングシステムに移動することができます。
@features_1455_h3
バックアップ
@features_1456_p
データベースが閉じられている時、データベースファイルのバックアップをとることが可能です。インデックスファイルはバックアップをとる必要はありません。なぜなら、インデックスファイルは冗長なデータを含み、もしファイルが存在しなければ自動的に再作成されるからです。
@features_1457_p
データベースが動作している間にバックアップデータをとるために、SQLコマンド SCRIPTを使うことができます。
@features_1458_h2
ログとリカバリー
@features_1459_p
データベースでデータが修正され、それらの変更がコミットされた時はいつでも、変更はディスクに記録されます (インメモリオブジェクトを除いて)。データファイル自体への変更は通常、ディスクアクセスを最適化するために後で書かれています。もし電源異常があった場合、データファイルとインデックスファイルはアップデートされません。しかし、変更がログファイルに書かれていれば、次回データベースを開いた時に、ログファイルに書かれた変更は自動的に再び適用されます。
@features_1460_p
インデックスファイルのアップデートはデフォルトでは記録されないことに注意して下さい。もしデータベースが開かれて、リカバリーが必要だとされたら、インデックスファイルは最初から作り替えられます。
@features_1461_p
通常、データベースごとにたったひとつのログファイルがあります。このファイルは、データベースが正常に終了されるまで増大し、削除されます。また、ファイルが大きくなりすぎたら、データベースは別のログファイルに交換します (より大きなIDで)。CHECKPOINT コマンドを使用することによって、ログの切り替えを強制することが可能です。
@features_1462_p
checksumのレコードが合わないために (例えば、別のアプリケーションからファイルが編集された場合) データベースファイルが破損したら、データベースをリカバリーモードで開くことができます。このケースでは、データベースのエラーは記録されますが、投げられません。データベースはスクリプトまでバックアップをとり、可能な限り早く再構築します。データベースをリカバリーモードで開くために、jdbc:h2:~/test;RECOVER=1 のように、RECOVER=1 を含むデータベースURLを使用します。この場合、インデックスは再構築され、サマリー (アロケーションテーブルのオブジェクト)は読まれないため、データベースを開くのに時間がかかります。
@features_1463_h2
互換性
@features_1464_p
#All database engines behave a little bit different. Where possible, H2 supports the ANSI SQL standard, and tries to be compatible to other databases. There are still a few differences however:
@features_1465_p
#In MySQL text columns are case insensitive by default, while in H2 they are case sensitive. However H2 supports case insensitive columns as well. To create the tables with case insensitive texts, append IGNORECASE=TRUE to the database URL (example: jdbc:h2:~/test;IGNORECASE=TRUE).
@features_1466_h3
互換モード
@features_1467_p
#For certain features, this database can emulate the behavior of specific databases. Not all features or differences of those databases are implemented. Here is the list of currently supported modes and the difference to the regular mode:
@features_1468_h3
#DB2 Compatibility Mode
@features_1469_p
#To use the IBM DB2 mode, use the database URL jdbc:h2:~/test;MODE=DB2
or the SQL statement SET MODE DB2
.
@features_1470_li
#For aliased columns, ResultSetMetaData.getColumnName() returns the alias name and getTableName() returns null.
@features_1471_li
#Support for the syntax [OFFSET .. ROW] [FETCH ... ONLY] as an alternative syntax for LIMIT .. OFFSET.
@features_1472_h3
#Derby Compatibility Mode
@features_1473_p
#To use the Apache Derby mode, use the database URL jdbc:h2:~/test;MODE=Derby
or the SQL statement SET MODE Derby
.
@features_1474_li
#For aliased columns, ResultSetMetaData.getColumnName() returns the alias name and getTableName() returns null.
@features_1475_li
#For unique indexes, NULL is distinct. That means only one row with NULL in one of the columns is allowed.
@features_1476_h3
#HSQLDB Compatibility Mode
@features_1477_p
#To use the HSQLDB mode, use the database URL jdbc:h2:~/test;MODE=HSQLDB
or the SQL statement SET MODE HSQLDB
.
@features_1478_li
#For aliased columns, ResultSetMetaData.getColumnName() returns the alias name and getTableName() returns null.
@features_1479_li
#When converting the scale of decimal data, the number is only converted if the new scale is smaller then current scale. Usually, the scale is converted and 0s are added if required.
@features_1480_li
#Concatenation of a NULL with another value results in NULL. Usually, the NULL is treated as an empty string if only one of the operators is NULL, and NULL is only returned if both values are NULL.
@features_1481_li
#For unique indexes, NULL is distinct. That means only one row with NULL in one of the columns is allowed.
@features_1482_h3
#MS SQL Server Compatibility Mode
@features_1483_p
#To use the MS SQL Server mode, use the database URL jdbc:h2:~/test;MODE=MSSQLServer
or the SQL statement SET MODE MSSQLServer
.
@features_1484_li
#For aliased columns, ResultSetMetaData.getColumnName() returns the alias name and getTableName() returns null.
@features_1485_li
#Identifiers may be quoted using square brackets as in [Test].
@features_1486_li
#For unique indexes, NULL is distinct. That means only one row with NULL in one of the columns is allowed.
@features_1487_h3
#MySQL Compatibility Mode
@features_1488_p
#To use the MySQL mode, use the database URL jdbc:h2:~/test;MODE=MySQL
or the SQL statement SET MODE MySQL
.
@features_1489_li
#When inserting data, if a column is defined to be NOT NULL and NULL is inserted, then a 0 (or empty string, or the current timestamp for timestamp columns) value is used. Usually, this operation is not allowed and an exception is thrown.
@features_1490_li
#Creating indexes in the CREATE TABLE statement should be supported.
@features_1491_li
#The identifiers should be returned in lower case.
@features_1492_li
#When converting a floating point number to a integer, the fractional digits should not be truncated, but the value should be rounded.
@features_1493_h3
#Oracle Compatibility Mode
@features_1494_p
#To use the Oracle mode, use the database URL jdbc:h2:~/test;MODE=Oracle
or the SQL statement SET MODE Oracle
.
@features_1495_li
#For aliased columns, ResultSetMetaData.getColumnName() returns the alias name and getTableName() returns null.
@features_1496_li
#When using unique indexes, multiple rows with NULL in all columns are allowed, however it is not allowed to have multiple rows with the same values otherwise.
@features_1497_h3
#PostgreSQL Compatibility Mode
@features_1498_p
#To use the PostgreSQL mode, use the database URL jdbc:h2:~/test;MODE=PostgreSQL
or the SQL statement SET MODE PostgreSQL
.
@features_1499_li
#For aliased columns, ResultSetMetaData.getColumnName() returns the alias name and getTableName() returns null.
@features_1500_li
#Concatenation of a NULL with another value results in NULL. Usually, the NULL is treated as an empty string if only one of the operators is NULL, and NULL is only returned if both values are NULL.
@features_1501_li
#When converting a floating point number to a integer, the fractional digits should not be truncated, but the value should be rounded.
@features_1502_li
#The system columns 'CTID' and 'OID' should be supported.
@features_1503_h2
#Auto-Reconnect
@features_1504_p
#The auto-reconnect feature causes the JDBC driver to reconnect to the database if the connection is lost. The automatic re-connect only occurs when auto-commit is enabled; if auto-commit is disabled, an exception is thrown.
@features_1505_p
#Re-connecting will open a new session. After an automatic re-connect, variables and local temporary tables definitions (excluding data) are re-created. The contents of the system table INFORMATION_SCHEMA.SESSION_STATE contains all client side state that is re-created.
@features_1506_h2
#Automatic Mixed Mode
@features_1507_p
#Multiple processes can access the same database without having to explicitly start the server. To do that, append ;AUTO_SERVER=TRUE
to the database URL. In this case, the first connection to the database is made in embedded mode, and additionally a server is started. If the database is already open in another process, the server mode is used.
@features_1508_p
#When using this feature, auto-reconnect is enabled as well.
@features_1509_p
#The application that opens the first connection to the database uses the embedded mode, which is faster than the server mode. Therefore the main application should open the database first if possible. A server is started on a random port. This server allows remote connections, however only to this database. In addition to the user name and password, the client sends the random key that is stored in .lock.db file to the server.
@features_1510_h2
トレースオプションを使用する
@features_1511_p
アプリケーション内の問題を見つけるために、時々、何のデータベースオペレーションがどこで実行されているかを知るのは良い方法です。このデータベースは次のトレースの特徴を提供します:
@features_1512_li
System.out と (または) ファイルをトレースする
@features_1513_li
トレースレベル OFF、ERROR、INFO と DEBUG をサポート
@features_1514_li
トレースファイルの最大サイズの設定が可能
@features_1515_li
Javaコード生成が可能
@features_1516_li
手動でファイルを作成することによって、ランタイムでトレースが可能
@features_1517_h3
トレースオプション
@features_1518_p
トレースオプションを可能にする簡単な方法は、データベースURLにトレースオプションを設定することです。二つの設定があり、ひとつは、System.out (TRACE_LEVEL_SYSTEM_OUT) トレーシングで、もうひとつはファイルトレーシング(TRACE_LEVEL_FILE)です。トレースレベルは、0 が OFF、1 が ERROR (デフォルト)、2 が INFO で 3 が DEBUGです。両方のレベルがDEBUGに設定されたデータベースURLです:
@features_1519_p
トレースレベルは、SQLコマンド SET TRACE_LEVEL_SYSTEM_OUT level
(System.out トレーシング) または SET TRACE_LEVEL_FILE level
(ファイルトレーシング) を実行することによってランタイムで変更できます。例:
@features_1520_h3
トレースファイルの最大サイズを設定
@features_1521_p
高いトレースレベルを使用する時、トレースファイルは早くサイズが非常に大きくなります。SQLステートメント SET TRACE_MAX_FILE_SIZE maximumFileSizeInMB
を実行することによりファイルのサイズを制限することができます。ログファイルが制限を超えたら、ファイルは ".old" にファイル名を変えて、新しいファイルが作成されます。もしもうひとつの .oldファイルが存在する場合は、それは削除されます。デフォルトの設定は16 MBです。例:
@features_1522_h3
Javaコード生成
@features_1523_p
トレースレベルをINFOかDEBUGに設定した時、同様にJavaのソースコードが生成されるので、問題はより簡単に再生されます。トレースファイルはこのようなものです:
@features_1524_p
Javaのソースコードを得るために、 /**/ のない行を取り除く必要があります。 Windowsでの簡単な方法は:
@features_1525_p
その後、コンパイルされる前にTrace.javaファイルを完全にする必要があります。例:
@features_1526_p
また、トレースファイルに載せられていないため、ユーザー名とパスワードが設定されている必要があります。
@features_1527_h2
#Using Other Logging APIs
@features_1528_p
#By default, this database uses its own native 'trace' facility. This facility is called 'trace' and not 'log' within this database to avoid confusion with the transaction log. Trace messages can be written to both file and System.out. In most cases, this is sufficient, however sometimes it is better to use the same facility as the application, for example Log4j. To do that, this database support SLF4J.
@features_1529_a
#SLF4J
@features_1530_p
#is a simple facade for various logging APIs and allows to plug in the desired implementation at deployment time. SLF4J supports implementations such as Logback, Log4j, Jakarta Commons Logging (JCL), JDK 1.4 logging, x4juli, and Simple Log.
@features_1531_p
#To enable SLF4J, set the file trace level to 4 in the database URL:
@features_1532_p
#Changing the log mechanism is not possible after the database is open, that means executing the SQL statement SET TRACE_LEVEL_FILE 4 when the database is already open will not have the desired effect. To use SLF4J, all required jar files need to be in the classpath. If it does not work, check in the file <database>.trace.db for error messages.
@features_1533_h2
読み取り専用データベース
@features_1534_p
データベースファイルが読み取り専用なら、同様にデータベースも読み取り専用です。このデータベースで新しいテーブルを作成したり、データを追加したり変更したりすることはできません。SELECTステートメントのみ許可されています。読み取り専用データベースを作成するには、データベースを終了してログファイルを小さくします。ログファイルを削除してはいけません。そして、オペレーティングシステムを使用してデータベースファイルを読み取り専用にします。これでデータベースを開くと、読み取り専用になっています。アプリケーションが、データベースが読み取り専用であることを判断する方法は二つあります: Connection.isReadOnly() を呼ぶか、SQLステートメント CALL READONLY() を実行します。
@features_1535_h2
#Read Only Databases in Zip or Jar File
@features_1536_p
#To create a read-only database in a zip, first create a regular persistent database, and then create a backup. If you are using a database named 'test', an easy way to do that is using the Backup tool or the BACKUP SQL statement:
@features_1537_p
#The database must not have pending changes, that means you need to close all connections to the database, open one single connection, and then execute the statement. Afterwards, you can log out, and directly open the database in the zip file using the following database URL:
@features_1538_p
#Databases in a zip file are read-only. The performance for some queries will be slower than when using a regular database, because random access in zip files is not supported (only streaming). How much this affects the performance depends on the queries and the data. The database is not read in memory; so large databases are supported as well. The same indexes are used than when using a regular database.
@features_1539_h2
ディスクスペースが少ない状況での正しい取り扱い
@features_1540_p
#If the database needs more disk space, it calls the database event listener if one is installed. The application may then delete temporary files, or display a message and wait until the user has resolved the problem. To install a listener, run the SQL statement SET DATABASE_EVENT_LISTENER or use a database URL of the form jdbc:h2:~/test;DATABASE_EVENT_LISTENER='com.acme.DbListener' (the quotes around the class name are required). See also the DatabaseEventListener API.
@features_1541_h3
破損したデータベースを開く
@features_1542_p
boot info (始動時に実行されるSQLスクリプト) が破損しているため、データベースを開くことができない場合、データベースイベントリスナーを指定することでデータベースを開くことができます。例外は記録されますが、データベースの開始は続行します。
@features_1543_h2
computed column / ベースインデックスの機能
@features_1544_p
インデックスの機能は、このデータベースによって直接サポートはされていませんが、computed columnsを使用することによって、簡単にエミュレートすることができます。例えば、カラムのupper-caseバージョンのインデックスが必要なら、原形のカラムのupper-caseバージョンのcomputed columnを作成し、このカラムにインデックスをつけます:
@features_1545_p
値は生成されているので、データを挿入する時、カラムのupper-caseバージョンのための値を指定する必要はありません (許可されていません)。 しかし、テーブルを呼ぶ時、このカラムを使用することはできます。:
@features_1546_h2
多次元インデックス
@features_1547_p
効率的な多次元の (空間的) 領域のクエリーを実行するためにツールを提供します。このデータベースは専門的な空間的インデックス (R-Tree またはより小さいもの) をサポートしていません。代わりに、B-Treeインデックスが使われています。それぞれのレコードに対して、多次元のキーは、単数範囲 (スカラー) の値に変換 (位置づけ) されます。この値は、space-filling curve (空間充填曲線) で位置を指定します。
@features_1548_p
現在、Z-order (N-order または Morton-order とも呼ばれています) が使用されています; Hilbert curveも使用できますが、実装はより複雑です。多次元の値を変換するアルゴリズムは、bit-interleavingと呼ばれています。B-Treeインデックス (通常は computed columnを使用します)を使用することで、スカラーの値はインデックスをつけられます。
@features_1549_p
最初のカラムにインデックスを使用する上で、メソッドは徹底的なパフォーマンスの改良をもたらすことができます。データと次元の数によりますが、改良は通常、factor 5よりも高いものです。指定された多次元の範囲から、ツールはSQLクエリーを生成します。使用されたメソッドは、データベースに依存しておらず、ツールは簡単に他のデータベースに移植することができます。ツールの使用方法の例は、TestMultiDimension.java で提供されているサンプルコードをご覧下さい。
@features_1550_h2
パスワードを使用する
@features_1551_h3
安全なパスワードを使用する
@features_1552_p
弱いパスワードは、暗号化やセキュリティプロトコルに取るに足らず、解読されてしまうことを覚えておいて下さい。辞書で見つけられるようなパスワードは使用しないでください。また、数字を付け足してもそのようなパスワードは安全にはなりません。良いパスワードを作る方法は、覚えやすい、文章の最初の文字を使う、大文字と小文字を使う、特別な文字が含まれているものを作る、です。例:
@features_1553_p
i'sE2rtPiUKtT (もしトリックを知っていれば、このパスワードは覚えやすいものです)
@features_1554_h3
パスワード: Stringの代わりにChar Arraysを使用する
@features_1555_p
Java Stringは不変のオブジェクトであり、アプリケーションによって安全に壊されることはできません。Stringの作成後、Stringは少なくともガベージコレクションになるまで、コンピューターのメインメモリ内にとどまるでしょう。ガベージコレクションはアプリケーションによって制御されず、ガベージコレクションであっても、データはまだメモリにとどまっているでしょう。パスワードが含まれるメモリの一部をディスクと取り換えることも可能でしょう (十分でないメインメモリも使用可能のため)。
@features_1556_p
アタッカーはオペレーティングシステムのスワップファイルにアクセスするでしょう。したがって、パスワードを保存するために、Stringの代わりにchar arrayを使用するのは良い方法です。char arrayは使用後クリアにされるので (0で埋められます)、パスワードはスワップファイルに保存されません。
@features_1557_p
このデータベースは、ユーザーパスワードとファイルパスワードを認証するために、Stringの代わりにchar arrayを使用することをサポートしています。次のコードはこのように使用されます:
@features_1558_p
このサンプルでは、パスワードはアプリケーションでのハードコードで、もちろん安全ではありません。しかし、Java Swingはchar arrayを使用してパスワードを得る方法をサポートしています (JPasswordField)。
@features_1559_h3
ユーザー名 と (または) パスワードをURLで認証する
@features_1560_p
#Instead of passing the user name as a separate parameter as in Connection conn = DriverManager. getConnection("jdbc:h2:~/test", "sa", "123");
the user name (and/or password) can be supplied in the URL itself: Connection conn = DriverManager. getConnection("jdbc:h2:~/test;USER=sa;PASSWORD=123");
The settings in the URL override the settings passed as a separate parameter.
@features_1561_h2
ユーザー定義の関数とストアドプロシージャ
@features_1562_p
組み込み関数に加えて、このデータベースはユーザー定義のJava関数をサポートしています。同様に、このデータベースではJava関数はストアドプロシージャとして使用されています。関数は、使用される前に宣言 (登録) されていなければなりません。static Javaメソッドのみサポートされています; クラスとメソッドの両方が public である必要があります。Javaメソッドの例:
@features_1563_p
Java関数は、CREATE ALIAS と呼ばれるデータベースに登録されていなければなりません:
@features_1564_p
完全なサンプルアプリケーションは src/test/org/h2/samples/Function.java をご覧下さい。
@features_1565_h3
データタイプマッピング関数
@features_1566_p
"int" のような non-nullable (NULL可能ではない) パラメータを受け入れる関数は、パラメータのうちひとつがNULLであるなら呼ばれないでしょう。このケースでは、NULLの値は結果として使用されます。このケースで関数を呼び出したいのなら、"int" の代わりに "java.lang.Integer" を使用する必要があります。
@features_1567_h3
接続を必要とする関数
@features_1568_p
もしJava関数の最初のパラメータが java.sql.Connection なら、データベースへの接続は与えられています。返す前にこの接続を閉じる必要はありません。
@features_1569_h3
例外を投げる関数
@features_1570_p
関数が例外を投げたら、現在のステートメントはロールバックされ、例外はアプリケーションに投げられます。
@features_1571_h3
Result Setを返す関数
@features_1572_p
関数はresult setを返します。このような関数はCALLステートメントと一緒に呼ばれます:
@features_1573_h3
SimpleResultSetを使用する
@features_1574_p
result setを返す関数は、SimpleResultSetツールを使用して最初からこのresult setを作成することができます:
@features_1575_h3
関数をテーブルとして使用する
@features_1576_p
result setを返す関数はテーブルのようになれます。しかし、このケースでは関数は少なくとも二回は呼ばれます: 最初はカラム名を集めるために構文解析している間です (コンパイル時に未知のところでパラメータはNULLに設定)。そして、データを取得するためにステートメントを実行している間です (これが結合なら繰り返されます)。関数がカラム一覧を取得するためだけに呼ばれたのなら、関数を認証する接続URLは jdbc:columnlist:connection です。そうでなければ、接続URLは jdbc:default:connection です。
@features_1577_h2
トリガー
@features_1578_p
このデータベースは、行が更新、挿入、または削除された前後に呼ばれるJavaトリガーをサポートしています。トリガーは複雑な一貫性チェックか、データベース内の関連したデータをアップデートするのに使用されます。マテリアライズドビューをシミュレートするためにトリガーを使用することも可能です。完全なサンプルアプリケーションは src/test/org/h2/samples/TriggerSample.java をご覧下さい。Javaトリガーは、インターフェイス org.h2.api.Trigger を実装しなければなりません:
@features_1579_p
他のテーブルのクエリーかデータのアップデートに接続を使用することができます。トリガーはその時データベースで定義されている必要があります:
@features_1580_p
トリガーはSQL Exceptionを投げることによって、変更を禁止させることができます。
@features_1581_h2
データベースをコンパクトにする
@features_1582_p
データベースファイルの空のスペースは自動的に再利用されます。インデックスを再構築するもっとも簡単な方法は、データベースが閉じられている間に .index.db ファイルを削除します。しかし、一部状況では (例えば、データベースの多数のデータを削除した後)、データベースのサイズを縮小したい場合があります (データベースをコンパクトにする)。そのためのサンプルです:
@features_1583_p
サンプルアプリケーション org.h2.samples.Compact もご覧下さい。データベースのバックアップを作るのと、スクリプトからデータベースを再構築するのにSCRIPT / RUNSCRIPT コマンドを使用することができます。
@features_1584_h2
キャッシュの設定
@features_1585_p
データベースは最も頻繁に使われるデータやインデックスページをメインメモリに保存します。キャッシュに使用されるメモリ量を CACHE_SIZE 設定を使用して変更することができます。この設定は、データベース接続URL (jdbc:h2:~/test;CACHE_SIZE=131072) か、ランタイムにSET CACHE_SIZE を使用してサイズを変更できます。
@features_1586_p
このデータベースは二つのcache page replacement algorithms (キャッシュページ置換アルゴリズム) をサポートしています: LRU (デフォルト) と2Qです。LRUは、キャッシュがいっぱいになったら、頻繁に使用されていないページをキャッシュから削除します。2Qアルゴリズムは少し複雑で、基本的に二つのクエリーが使用されます。2Qアルゴリズムはテーブルスキャンに、より抵抗がありますが、LRUと比較してオーバーヘッドは少し高めです。キャッシュアルゴリズム 2Qを使用するためには、フォームのデータベースURL jdbc:h2:~/test;CACHE_TYPE=TQ を使用します。キャッシュアルゴリズムは、一度データベースが開かれたら変更することはできません。
@features_1587_p
読んだり書いたりしたページや、現在使用されているキャッシュアルゴリズムの情報を得るためには、SELECT * FROM INFORMATION_SCHEMA.SETTINGS を呼びます。データとインデックスファイルに読み書きしたページ数が書かれています。
@fragments_1000_b
検索:
@fragments_1001_td
Highlight keyword(s)
@fragments_1002_a
ホーム
@fragments_1003_a
クイックスタート
@fragments_1004_a
インストール
@fragments_1005_a
チュートリアル
@fragments_1006_a
特徴
@fragments_1007_a
パフォーマンス
@fragments_1008_a
進歩したトピックス
@fragments_1009_a
#JaQu
@fragments_1010_a
ダウンロード
@fragments_1011_b
参照
@fragments_1012_a
SQL文法
@fragments_1013_a
関数
@fragments_1014_a
データ型
@fragments_1015_a
Javadoc
@fragments_1016_a
PDFドキュメント
@fragments_1017_a
#Error Analyzer
@fragments_1018_b
付録
@fragments_1019_a
ビルド
@fragments_1020_a
歴史とロードマップ
@fragments_1021_a
#Links
@fragments_1022_a
FAQ
@fragments_1023_a
ライセンス
@fragments_1024_td
@frame_1000_h1
H2 データベース エンジン
@frame_1001_p
#Welcome to H2, the free SQL database. The main feature of H2 are:
@frame_1002_li
#It is free to use for everybody, source code is included
@frame_1003_li
#Written in Java, but also available as native executable
@frame_1004_li
#JDBC and (partial) ODBC API
@frame_1005_li
#Embedded and client/server modes
@frame_1006_li
#Clustering is supported
@frame_1007_li
#A web client is included
@frame_1008_h2
#No Javascript
@frame_1009_p
#If you are not automatically redirected to the main page, then Javascript is currently disabled or your browser does not support Javascript. Some features (for example the integrated search) require Javascript.
@frame_1010_p
#Please enable Javascript, or go ahead without it: H2 Database Engine
@history_1000_h1
歴史とロードマップ
@history_1001_a
変更履歴
@history_1002_a
ロードマップ
@history_1003_a
このデータベースエンジンの歴史
@history_1004_a
なぜJavaなのか
@history_1005_a
支援者
@history_1006_h2
変更履歴
@history_1007_p
#The up-to-date change log is available at http://www.h2database.com/html/changelog.html
@history_1008_h2
ロードマップ
@history_1009_p
#The current roadmap is available at http://www.h2database.com/html/roadmap.html
@history_1010_h2
このデータベースエンジンの歴史
@history_1011_p
H2DBの開発は2004年の5月に開始されましたが、初めて世に出たのは、2005年12月14日の事でした。生みの親であるThomas Muellerは、Hypersonic SQLの初期の開発者でもあります。2001年、彼はPointBaseMicroを生み出したPointBaseInc.に入社しました。この時点で彼はHypersonic SQLの開発を断念しなければなりませんでしたが、引き続きHypersonic SQLのコードベース開発を進める目的でHSQLDBグループが設立されました。H2DBの H2 は、このHypersonic 2を意味しています。とはいえ、H2DBはHypersonic SQLやHSQLDBとはコードの共有を一切行わず、すべてゼロから開発されました。
@history_1012_h2
なぜJavaなのか
@history_1013_p
Javaデータベースを使用するいくつかの理由:
@history_1014_li
Javaアプリケーションの統合は非常に簡単
@history_1015_li
多数の異なったプラットフォームのサポート
@history_1016_li
ネイティブアプリケーションより、より安全 (バッファーのオーバーフローがない)
@history_1017_li
#User defined functions (or triggers) run very fast
@history_1018_li
Unicodeをサポート
@history_1019_p
低いレベルでのオペレーションでは、Javaはまだ低速すぎると思う方もいますが、そうではありません (それ以上でもありません)。一般的に、C、またはC++を使用するよりもずっと速くコードを書くことができます。このように、コードを移植して、低レベルのもの (スレッドのメモリ管理か取り扱いのような) に対処するよりもむしろ、アルゴリズムの改良(アプリケーションをより速くする) に集中することが可能です。ガーベジコレクションは今や手動でのメモリ管理よりおそらく速いでしょう。
@history_1020_p
#A lot of features are already built in (for example Unicode, network libraries). It is very easy to write secure code because buffer overflows can not occur. Some features such as the reflection mechanism can be used for randomized testing.
@history_1021_p
Javaは将来への証明でもあります: 多くの会社がJavaをサポートし、今ではオープンソースです。
@history_1022_p
このソフトウェアは、移植性の増加と使いやすさのため、そしてパフォーマンスの理由から、多くのJavaライブラリ、または他のソフトウェアを信頼していません。例えば、暗号化アルゴリズムと多数のライブラリ関数は、存在するライブラリを使用する代わりにデータベースに実装されています。SwingのようなオープンソースのJava実装が有効でないライブラリは使用されていないか、特定の特徴のみに使用されます。
@history_1023_h2
支援者
@history_1024_p
#Many thanks for those who helped by finding and reporting bugs, gave valuable feedback, spread the word and have translated this project. Also many thanks to the donors who contributed via PayPal:
@history_1025_a
#SkyCash, Poland
@history_1026_li
#Donald Bleyl, USA
@history_1027_li
#lumber-mill.co.jp, Japan
@history_1028_li
#Frank Berger, Germany
@history_1029_li
#Ashwin Jayaprakash, USA
@history_1030_li
#Florent Ramiere, France
@history_1031_li
#Jun Iyama, Japan
@history_1032_li
#Antonio Casqueiro, Portugal
@history_1033_li
#Oliver Computing LLC, USA
@history_1034_li
#Harpal Grover Consulting Inc., USA
@history_1035_li
#Elisabetta Berlini, Italy
@history_1036_li
#William Gilbert, USA
@history_1037_li
#Antonio Dieguez, Chile
@history_1038_a
#Ontology Works, USA
@history_1039_li
#Pete Haidinyak, USA
@history_1040_li
#William Osmond, USA
@history_1041_li
#Joachim Ansorg, Germany
@history_1042_li
#Oliver Soerensen, Germany
@installation_1000_h1
インストール
@installation_1001_a
必要条件
@installation_1002_a
サポートされているプラットフォーム
@installation_1003_a
ソフトウェアのインストール
@installation_1004_a
ディレクトリ構成
@installation_1005_h2
必要条件
@installation_1006_p
データベースを実行するために、以下のソフトウェアが動作することを確認します。
@installation_1007_li
#Windows XP, Mac OS X, or Linux
@installation_1008_li
推奨されるWindowsファイルシステム: NTFS (FAT32は4GB以上ファイルをサポートします)
@installation_1009_li
Sun JDK 1.4以降
@installation_1010_li
Mozilla Firefox 1.5以降
@installation_1011_h2
サポートされているプラットフォーム
@installation_1012_p
#As this database is written in Java, it can run on many different platforms. It is tested with Java 1.4, 1.5, and 1.6 but can also be compiled to native code using GCJ. The source code does not use features of Java 1.5. Currently, the database is developed and tested on Windows XP and Mac OS X using the Sun JDK 1.5, but it also works in many other operating systems and using other Java runtime environments.
@installation_1013_h2
ソフトウェアのインストール
@installation_1014_p
ソフトウェアをインストールするために、インストーラーを実行するか 選択したディレクトリにソフトウェアを解凍します。
@installation_1015_h2
ディレクトリ構成
@installation_1016_p
インストール後、下記のディレクトリ構成が作られます:
@installation_1017_th
ディレクトリ
@installation_1018_th
コンテンツ
@installation_1019_td
bin
@installation_1020_td
JARとbatchファイル
@installation_1021_td
docs
@installation_1022_td
ドキュメント
@installation_1023_td
docs/html
@installation_1024_td
HTMLページ
@installation_1025_td
docs/javadoc
@installation_1026_td
Javadocファイル
@installation_1027_td
#ext
@installation_1028_td
#External dependencies (downloaded when building)
@installation_1029_td
service
@installation_1030_td
Windows Serviceとしてデータベースを実行するツール
@installation_1031_td
src
@installation_1032_td
Sourceファイル
@jaqu_1000_h1
#JaQu
@jaqu_1001_h2
#What is JaQu
@jaqu_1002_p
#JaQu stands for Java Query and allows to access databases using pure Java. JaQu provides a fluent interface (or internal DSL) for building SQL statements. JaQu replaces SQL, JDBC, and object/relation frameworks such as Hibernate. JaQu is something like LINQ for Java (LINQ stands for "language integrated query" and is a Microsoft .NET technology). The following JaQu code:
@jaqu_1003_p
#stands for the SQL statement:
@jaqu_1004_h2
#Advantages and Differences to other Data Access Tools
@jaqu_1005_p
#Unlike SQL, JaQu can be easily integrated in Java applications. Because JaQu is pure Java, Javadoc and auto-complete are supported. Type checking is performed by the compiler. JaQu fully protects against SQL injection.
@jaqu_1006_p
#JaQu is much smaller than object/relation mapping tools such as Hibernate. Unlike iBatis and Hibernate, no XML or annotation based configuration is required; instead the configuration (if required at all) is done in pure Java, in the application itself.
@jaqu_1007_p
#JaQu does not require or contain any data caching mechanism. Like JDBC and iBatis, JaQu provides full control over when and what SQL statements are executed.
@jaqu_1008_h3
#Restrictions
@jaqu_1009_p
#Primitive types (eg. boolean, int, long, double) are not supported. Instead, Boolean, Integer, Long, and Double must be used.
@jaqu_1010_h3
#Why in Java?
@jaqu_1011_p
#Most people use Java in their application. Mixing Java and another language (for example Scala or Groovy) in the same application is complicated. It would be required to split the code to access the database and the application code.
@jaqu_1012_h2
#Current State
@jaqu_1013_p
#JaQu is not yet stable, and not part of the h2 jar file. However the source code is included in H2, under:
@jaqu_1014_li
#src/test/org/h2/test/jaqu/* (samples and tests)
@jaqu_1015_li
#src/tools/org/h2/jaqu/* (framework)
@jaqu_1016_h2
#Building the JaQu library
@jaqu_1017_p
#To create the JaQu jar file, run: build jarJaqu
. This will create the file bin/h2jaqu.jar
.
@jaqu_1018_h2
必要条件
@jaqu_1019_p
#JaQu requires Java 1.5. Annotations are not need. Currently, JaQu is only tested with the H2 database engine, however in theory it should work with any database that supports the JDBC API.
@jaqu_1020_h2
#Example Code
@jaqu_1021_h2
#Configuration
@jaqu_1022_p
#JaQu does not require any kind of configuration is you want to use the default mapping. To define table indices, or if you want to map a class to a table with a different name, or a field to a column with another name, create a function called 'define' in the data class. Example:
@jaqu_1023_p
#The method 'define()' contains the mapping definition. It is called once when the class is used for the first time. Like annotations, the mapping is defined in the class itself. Unlike when using annotations, the compiler can check the syntax even for multi-column objects (multi-column indexes, multi-column primary keys and so on). This solution is very flexible because the definition is written in regular Java code: Unlike when using annotations, your code can select the right configuration depending on the environment if required. Unlike XML mapping configuration, the configuration is integrated in the class itself.
@jaqu_1024_h2
#Ideas
@jaqu_1025_p
#This project has just been started, and nothing is fixed yet. Some ideas for what to implement include:
@jaqu_1026_li
#Support queries on collections (instead of using a database).
@jaqu_1027_li
#Provide API level compatibility with JPA (so that JaQu can be used as an extension of JPA).
@jaqu_1028_li
#Internally use a JPA implementation (for example Hibernate) instead of SQL directly.
@jaqu_1029_li
#Use PreparedStatements and cache them.
@jaqu_1030_h2
#Related Projects
@jaqu_1031_a
#Empire-db
@jaqu_1032_a
#JEQUEL: Java Embedded QUEry Language
@jaqu_1033_a
#JoSQL
@jaqu_1034_a
#LIQUidFORM
@jaqu_1035_a
#Quaere (Alias implementation)
@jaqu_1036_a
#Quaere
@jaqu_1037_a
#Querydsl
@jaqu_1038_a
#Squill
@license_1000_h1
ライセンス
@license_1001_h2
#Summary and License FAQ
@license_1002_p
#H2 is dual licensed and available under a modified version of the MPL 1.1 ( Mozilla Public License ) or under the (unmodified) EPL 1.0 ( Eclipse Public License ). The changes to the MPL are
@license_1003_em
#underlined . There is a License FAQ for both the MPL and the EPL, most of that is applicable to the H2 License as well.
@license_1004_li
#You can use H2 for free. You can integrate it into your application (including commercial applications), and you can distribute it.
@license_1005_li
#Files containing only your code are not covered by this license (it is 'commercial friendly').
@license_1006_li
#Modifications to the H2 source code must be published.
@license_1007_li
#You don't need to provide the source code of H2 if you did not modify anything.
@license_1008_p
#However, nobody is allowed to rename H2, modify it a little, and sell it as a database engine without telling the customers it is in fact H2. This happened to HSQLDB, when a company called 'bungisoft' copied HSQLDB, renamed it to 'RedBase', and tried to sell it, hiding the fact that it was, in fact, just HSQLDB. At this time, it seems 'bungisoft' does not exist any more, but you can use the Wayback Machine of http://www.archive.org and look for old web pages of http://www.bungisoft.com .
@license_1009_p
#About porting the source code to another language (for example C# or C++): Converted source code (even if done manually) stays under the same copyright and license as the original code. The copyright of the ported source code does not (automatically) go to the person who ported the code.
@license_1010_h2
#H2 License, Version 1.0
@license_1011_h3
#1. Definitions
@license_1012_b
#1.0.1. "Commercial Use"
@license_1013_p
#means distribution or otherwise making the Covered Code available to a third party.
@license_1014_b
#1.1. "Contributor"
@license_1015_p
#means each entity that creates or contributes to the creation of Modifications.
@license_1016_b
#1.2. "Contributor Version"
@license_1017_p
#means the combination of the Original Code, prior Modifications used by a Contributor, and the Modifications made by that particular Contributor.
@license_1018_b
#1.3. "Covered Code"
@license_1019_p
#means the Original Code or Modifications or the combination of the Original Code and Modifications, in each case including portions thereof.
@license_1020_b
#1.4. "Electronic Distribution Mechanism"
@license_1021_p
#means a mechanism generally accepted in the software development community for the electronic transfer of data.
@license_1022_b
#1.5. "Executable"
@license_1023_p
#means Covered Code in any form other than Source Code.
@license_1024_b
#1.6. "Initial Developer"
@license_1025_p
#means the individual or entity identified as the Initial Developer in the Source Code notice required by Exhibit A .
@license_1026_b
#1.7. "Larger Work"
@license_1027_p
#means a work which combines Covered Code or portions thereof with code not governed by the terms of this License.
@license_1028_b
#1.8. "License"
@license_1029_p
#means this document.
@license_1030_b
#1.8.1. "Licensable"
@license_1031_p
#means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently acquired, any and all of the rights conveyed herein.
@license_1032_b
#1.9. "Modifications"
@license_1033_p
#means any addition to or deletion from the substance or structure of either the Original Code or any previous Modifications. When Covered Code is released as a series of files, a Modification is:
@license_1034_p
#1.9.a. Any addition to or deletion from the contents of a file containing Original Code or previous Modifications.
@license_1035_p
#1.9.b. Any new file that contains any part of the Original Code or previous Modifications.
@license_1036_b
#1.10. "Original Code"
@license_1037_p
#means Source Code of computer software code which is described in the Source Code notice required by Exhibit A as Original Code, and which, at the time of its release under this License is not already Covered Code governed by this License.
@license_1038_b
#1.10.1. "Patent Claims"
@license_1039_p
#means any patent claim(s), now owned or hereafter acquired, including without limitation, method, process, and apparatus claims, in any patent Licensable by grantor.
@license_1040_b
#1.11. "Source Code"
@license_1041_p
#means the preferred form of the Covered Code for making modifications to it, including all modules it contains, plus any associated interface definition files, scripts used to control compilation and installation of an Executable, or source code differential comparisons against either the Original Code or another well known, available Covered Code of the Contributor's choice. The Source Code can be in a compressed or archival form, provided the appropriate decompression or de-archiving software is widely available for no charge.
@license_1042_b
#1.12. "You" (or "Your")
@license_1043_p
#means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License or a future version of this License issued under Section 6.1. For legal entities, "You" includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, "control" means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity.
@license_1044_h3
#2. Source Code License
@license_1045_h4
#2.1. The Initial Developer Grant
@license_1046_p
#The Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims:
@license_1047_p
#2.1.a. under intellectual property rights (other than patent or trademark) Licensable by Initial Developer to use, reproduce, modify, display, perform, sublicense and distribute the Original Code (or portions thereof) with or without Modifications, and/or as part of a Larger Work; and
@license_1048_p
#2.1.b. under Patents Claims infringed by the making, using or selling of Original Code, to make, have made, use, practice, sell, and offer for sale, and/or otherwise dispose of the Original Code (or portions thereof).
@license_1049_p
#2.1.c. the licenses granted in this Section 2.1 ( a ) and ( b ) are effective on the date Initial Developer first distributes Original Code under the terms of this License.
@license_1050_p
#2.1.d. Notwithstanding Section 2.1 ( b ) above, no patent license is granted: 1) for code that You delete from the Original Code; 2) separate from the Original Code; or 3) for infringements caused by: i) the modification of the Original Code or ii) the combination of the Original Code with other software or devices.
@license_1051_h4
#2.2. Contributor Grant
@license_1052_p
#Subject to third party intellectual property claims, each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license
@license_1053_p
#2.2.a. under intellectual property rights (other than patent or trademark) Licensable by Contributor, to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof) either on an unmodified basis, with other Modifications, as Covered Code and/or as part of a Larger Work; and
@license_1054_p
#2.2.b. under Patent Claims infringed by the making, using, or selling of Modifications made by that Contributor either alone and/or in combination with its Contributor Version (or portions of such combination), to make, use, sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications made by that Contributor (or portions thereof); and 2) the combination of Modifications made by that Contributor with its Contributor Version (or portions of such combination).
@license_1055_p
#2.2.c. the licenses granted in Sections 2.2 ( a ) and 2.2 ( b ) are effective on the date Contributor first makes Commercial Use of the Covered Code.
@license_1056_p
#2.2.c. Notwithstanding Section 2.2 ( b ) above, no patent license is granted: 1) for any code that Contributor has deleted from the Contributor Version; 2) separate from the Contributor Version; 3) for infringements caused by: i) third party modifications of Contributor Version or ii) the combination of Modifications made by that Contributor with other software (except as part of the Contributor Version) or other devices; or 4) under Patent Claims infringed by Covered Code in the absence of Modifications made by that Contributor.
@license_1057_h3
#3. Distribution Obligations
@license_1058_h4
#3.1. Application of License
@license_1059_p
#The Modifications which You create or to which You contribute are governed by the terms of this License, including without limitation Section 2.2 . The Source Code version of Covered Code may be distributed only under the terms of this License or a future version of this License released under Section 6.1 , and You must include a copy of this License with every copy of the Source Code You distribute. You may not offer or impose any terms on any Source Code version that alters or restricts the applicable version of this License or the recipients' rights hereunder. However, You may include an additional document offering the additional rights described in Section 3.5 .
@license_1060_h4
#3.2. Availability of Source Code
@license_1061_p
#Any Modification which You create or to which You contribute must be made available in Source Code form under the terms of this License either on the same media as an Executable version or via an accepted Electronic Distribution Mechanism to anyone to whom you made an Executable version available; and if made available via Electronic Distribution Mechanism, must remain available for at least twelve (12) months after the date it initially became available, or at least six (6) months after a subsequent version of that particular Modification has been made available to such recipients. You are responsible for ensuring that the Source Code version remains available even if the Electronic Distribution Mechanism is maintained by a third party.
@license_1062_h4
#3.3. Description of Modifications
@license_1063_p
#You must cause all Covered Code to which You contribute to contain a file documenting the changes You made to create that Covered Code and the date of any change. You must include a prominent statement that the Modification is derived, directly or indirectly, from Original Code provided by the Initial Developer and including the name of the Initial Developer in (a) the Source Code, and (b) in any notice in an Executable version or related documentation in which You describe the origin or ownership of the Covered Code.
@license_1064_h4
#3.4. Intellectual Property Matters
@license_1065_b
#3.4.a. Third Party Claims:
@license_1066_p
#If Contributor has knowledge that a license under a third party's intellectual property rights is required to exercise the rights granted by such Contributor under Sections 2.1 or 2.2 , Contributor must include a text file with the Source Code distribution titled "LEGAL" which describes the claim and the party making the claim in sufficient detail that a recipient will know whom to contact. If Contributor obtains such knowledge after the Modification is made available as described in Section 3.2 , Contributor shall promptly modify the LEGAL file in all copies Contributor makes available thereafter and shall take other steps (such as notifying appropriate mailing lists or newsgroups) reasonably calculated to inform those who received the Covered Code that new knowledge has been obtained.
@license_1067_b
#3.4.b. Contributor APIs:
@license_1068_p
#If Contributor's Modifications include an application programming interface and Contributor has knowledge of patent licenses which are reasonably necessary to implement that API, Contributor must also include this information in the legal file.
@license_1069_b
#3.4.c. Representations:
@license_1070_p
#Contributor represents that, except as disclosed pursuant to Section 3.4 ( a ) above, Contributor believes that Contributor's Modifications are Contributor's original creation(s) and/or Contributor has sufficient rights to grant the rights conveyed by this License.
@license_1071_h4
#3.5. Required Notices
@license_1072_p
#You must duplicate the notice in Exhibit A in each file of the Source Code. If it is not possible to put such notice in a particular Source Code file due to its structure, then You must include such notice in a location (such as a relevant directory) where a user would be likely to look for such a notice. If You created one or more Modification(s) You may add your name as a Contributor to the notice described in Exhibit A . You must also duplicate this License in any documentation for the Source Code where You describe recipients' rights or ownership rights relating to Covered Code. You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Code. However, You may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear than any such warranty, support, indemnity or liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of warranty, support, indemnity or liability terms You offer.
@license_1073_h4
#3.6. Distribution of Executable Versions
@license_1074_p
#You may distribute Covered Code in Executable form only if the requirements of Sections 3.1 , 3.2 , 3.3 , 3.4 and 3.5 have been met for that Covered Code, and if You include a notice stating that the Source Code version of the Covered Code is available under the terms of this License, including a description of how and where You have fulfilled the obligations of Section 3.2 . The notice must be conspicuously included in any notice in an Executable version, related documentation or collateral in which You describe recipients' rights relating to the Covered Code. You may distribute the Executable version of Covered Code or ownership rights under a license of Your choice, which may contain terms different from this License, provided that You are in compliance with the terms of this License and that the license for the Executable version does not attempt to limit or alter the recipient's rights in the Source Code version from the rights set forth in this License. If You distribute the Executable version under a different license You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer or any Contributor. You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of any such terms You offer.
@license_1075_h4
#3.7. Larger Works
@license_1076_p
#You may create a Larger Work by combining Covered Code with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Code.
@license_1077_h3
#4. Inability to Comply Due to Statute or Regulation.
@license_1078_p
#If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Code due to statute, judicial order, or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be included in the legal file described in Section 3.4 and must be included with all distributions of the Source Code. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it.
@license_1079_h3
#5. Application of this License.
@license_1080_p
#This License applies to code to which the Initial Developer has attached the notice in Exhibit A and to related Covered Code.
@license_1081_h3
#6. Versions of the License.
@license_1082_h4
#6.1. New Versions
@license_1083_p
#The
@license_1084_em
#H2 Group may publish revised and/or new versions of the License from time to time. Each version will be given a distinguishing version number.
@license_1085_h4
#6.2. Effect of New Versions
@license_1086_p
#Once Covered Code has been published under a particular version of the License, You may always continue to use it under the terms of that version. You may also choose to use such Covered Code under the terms of any subsequent version of the License published by the
@license_1087_em
#H2 Group . No one other than the
@license_1088_em
#H2 Group has the right to modify the terms applicable to Covered Code created under this License.
@license_1089_h4
#6.3. Derivative Works
@license_1090_p
#If You create or use a modified version of this License (which you may only do in order to apply it to code which is not already Covered Code governed by this License), You must (a) rename Your license so that the phrases
@license_1091_em
#"H2 Group", "H2" or any confusingly similar phrase do not appear in your license (except to note that your license differs from this License) and (b) otherwise make it clear that Your version of the license contains terms which differ from the
@license_1092_em
#H2 License . (Filling in the name of the Initial Developer, Original Code or Contributor in the notice described in Exhibit A shall not of themselves be deemed to be modifications of this License.)
@license_1093_h3
#7. Disclaimer of Warranty
@license_1094_p
#Covered code is provided under this license on an "as is" basis, without warranty of any kind, either expressed or implied, including, without limitation, warranties that the covered code is free of defects, merchantable, fit for a particular purpose or non-infringing. The entire risk as to the quality and performance of the covered code is with you. Should any covered code prove defective in any respect, you (not the initial developer or any other contributor) assume the cost of any necessary servicing, repair or correction. This disclaimer of warranty constitutes an essential part of this license. No use of any covered code is authorized hereunder except under this disclaimer.
@license_1095_h3
#8. Termination
@license_1096_p
#8.1. This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. All sublicenses to the Covered Code which are properly granted shall survive any termination of this License. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive.
@license_1097_p
#8.2. If You initiate litigation by asserting a patent infringement claim (excluding declaratory judgment actions) against Initial Developer or a Contributor (the Initial Developer or Contributor against whom You file such action is referred to as "Participant") alleging that:
@license_1098_p
#8.2.a. such Participant's Contributor Version directly or indirectly infringes any patent, then any and all rights granted by such Participant to You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice from Participant terminate prospectively, unless if within 60 days after receipt of notice You either: (i) agree in writing to pay Participant a mutually agreeable reasonable royalty for Your past and future use of Modifications made by such Participant, or (ii) withdraw Your litigation claim with respect to the Contributor Version against such Participant. If within 60 days of notice, a reasonable royalty and payment arrangement are not mutually agreed upon in writing by the parties or the litigation claim is not withdrawn, the rights granted by Participant to You under Sections 2.1 and/or 2.2 automatically terminate at the expiration of the 60 day notice period specified above.
@license_1099_p
#8.2.b. any software, hardware, or device, other than such Participant's Contributor Version, directly or indirectly infringes any patent, then any rights granted to You by such Participant under Sections 2.1( b ) and 2.2( b ) are revoked effective as of the date You first made, used, sold, distributed, or had made, Modifications made by that Participant.
@license_1100_p
#8.3. If You assert a patent infringement claim against Participant alleging that such Participant's Contributor Version directly or indirectly infringes any patent where such claim is resolved (such as by license or settlement) prior to the initiation of patent infringement litigation, then the reasonable value of the licenses granted by such Participant under Sections 2.1 or 2.2 shall be taken into account in determining the amount or value of any payment or license.
@license_1101_p
#8.4. In the event of termination under Sections 8.1 or 8.2 above, all end user license agreements (excluding distributors and resellers) which have been validly granted by You or any distributor hereunder prior to termination shall survive termination.
@license_1102_h3
#9. Limitation of Liability
@license_1103_p
#Under no circumstances and under no legal theory, whether tort (including negligence), contract, or otherwise, shall you, the initial developer, any other contributor, or any distributor of covered code, or any supplier of any of such parties, be liable to any person for any indirect, special, incidental, or consequential damages of any character including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses, even if such party shall have been informed of the possibility of such damages. This limitation of liability shall not apply to liability for death or personal injury resulting from such party's negligence to the extent applicable law prohibits such limitation. Some jurisdictions do not allow the exclusion or limitation of incidental or consequential damages, so this exclusion and limitation may not apply to you.
@license_1104_h3
#10. United States Government End Users
@license_1105_p
#The Covered Code is a "commercial item", as that term is defined in 48 C.F.R. 2.101 (October 1995), consisting of "commercial computer software" and "commercial computer software documentation", as such terms are used in 48 C.F.R. 12.212 (September 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Code with only those rights set forth herein.
@license_1106_h3
#11. Miscellaneous
@license_1107_p
#This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by California law provisions (except to the extent applicable law, if any, provides otherwise), excluding its conflict-of-law provisions. With respect to disputes in which at least one party is a citizen of, or an entity chartered or registered to do business in United States of America, any litigation relating to this License shall be subject to the jurisdiction of the Federal Courts of the Northern District of California, with venue lying in Santa Clara County, California, with the losing party responsible for costs, including without limitation, court costs and reasonable attorneys' fees and expenses. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License.
@license_1108_h3
#12. Responsibility for Claims
@license_1109_p
#As between Initial Developer and the Contributors, each party is responsible for claims and damages arising, directly or indirectly, out of its utilization of rights under this License and You agree to work with Initial Developer and Contributors to distribute such responsibility on an equitable basis. Nothing herein is intended or shall be deemed to constitute any admission of liability.
@license_1110_h3
#13. Multiple-Licensed Code
@license_1111_p
#Initial Developer may designate portions of the Covered Code as "Multiple-Licensed". "Multiple-Licensed" means that the Initial Developer permits you to utilize portions of the Covered Code under Your choice of this or the alternative licenses, if any, specified by the Initial Developer in the file described in Exhibit A .
@license_1112_h3
#Exhibit A
@license_1113_h2
#Eclipse Public License - Version 1.0
@license_1114_p
#THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
@license_1115_h3
#1. DEFINITIONS
@license_1116_p
#"Contribution" means:
@license_1117_p
#a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
@license_1118_p
#b) in the case of each subsequent Contributor:
@license_1119_p
#i) changes to the Program, and
@license_1120_p
#ii) additions to the Program;
@license_1121_p
#where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program.
@license_1122_p
#"Contributor" means any person or entity that distributes the Program.
@license_1123_p
#"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.
@license_1124_p
#"Program" means the Contributions distributed in accordance with this Agreement.
@license_1125_p
#"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
@license_1126_h3
#2. GRANT OF RIGHTS
@license_1127_p
#a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.
@license_1128_p
#b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
@license_1129_p
#c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.
@license_1130_p
#d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.
@license_1131_h3
#3. REQUIREMENTS
@license_1132_p
#A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
@license_1133_p
#a) it complies with the terms and conditions of this Agreement; and
@license_1134_p
#b) its license agreement:
@license_1135_p
#i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;
@license_1136_p
#ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;
@license_1137_p
#iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and
@license_1138_p
#iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.
@license_1139_p
#When the Program is made available in source code form:
@license_1140_p
#a) it must be made available under this Agreement; and
@license_1141_p
#b) a copy of this Agreement must be included with each copy of the Program.
@license_1142_p
#Contributors may not remove or alter any copyright notices contained within the Program.
@license_1143_p
#Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution.
@license_1144_h3
#4. COMMERCIAL DISTRIBUTION
@license_1145_p
#Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.
@license_1146_p
#For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.
@license_1147_h3
#5. NO WARRANTY
@license_1148_p
#EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
@license_1149_h3
#6. DISCLAIMER OF LIABILITY
@license_1150_p
#EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
@license_1151_h3
#7. GENERAL
@license_1152_p
#If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
@license_1153_p
#If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed.
@license_1154_p
#All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.
@license_1155_p
#Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
@license_1156_p
#This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.
@links_1000_h1
#H2 In Use and Links
@links_1001_p
#Those are just a few links to products using or supporting H2. If you want to add a link, please send it to the support email address or post it in the group.
@links_1002_h2
#Books
@links_1003_a
#Seam In Action
@links_1004_h2
#Extensions
@links_1005_a
#Grails H2 Database Plugin
@links_1006_a
#h2osgi: OSGi for the H2 Database
@links_1007_a
#H2Sharp: ADO.NET interface for the H2 database engine
@links_1008_a
#H2 Spatial: spatial functions to H2 database
@links_1009_h2
#Blogs
@links_1010_a
#Porting Flexive to the H2 Database (2008-12-05)
@links_1011_a
#H2 Database with GlassFish (2008-11-24)
@links_1012_a
#Using H2 Database with Glassfish and Toplink (2008-08-07)
@links_1013_a
#H2 Database - Performance Tracing (2008-04-30)
@links_1014_a
#Testing your JDBC data access layer with DBUnit and H2 (2007-09-18)
@links_1015_a
#Open Source Databases Comparison (2007-09-11)
@links_1016_a
#The Codist: The Open Source Frameworks I Use (2007-07-23)
@links_1017_a
#The Codist: SQL Injections: How Not To Get Stuck (2007-05-08)
@links_1018_a
#One Man Band: (Helma + H2) == "to easy" (2007-03-11)
@links_1019_a
#David Coldrick's Weblog: New Version of H2 Database Released (2007-01-06)
@links_1020_a
#The Codist: Write Your Own Database, Again (2006-11-13)
@links_1021_h2
#Project Pages
@links_1022_a
#Ohloh
@links_1023_a
#Freshmeat Project Page
@links_1024_a
#Wikipedia
@links_1025_a
#Java Source Net
@links_1026_a
#Linux Package Manager
@links_1027_h2
#Database Frontends / Tools
@links_1028_a
#DB Solo
@links_1029_p
#SQL query tool.
@links_1030_a
#DbVisualizer
@links_1031_p
#Database tool.
@links_1032_a
#Execute Query
@links_1033_p
#Database utility written in Java.
@links_1034_a
#[fleXive]
@links_1035_p
#JavaEE 5 open source framework for the development of complex and evolving (web-)applications.
@links_1036_a
#HenPlus
@links_1037_p
#HenPlus is a SQL shell written in Java.
@links_1038_a
#RazorSQL
@links_1039_p
#An SQL query tool, database browser, SQL editor, and database administration tool.
@links_1040_a
#SQL Developer
@links_1041_p
#Universal Database Frontend.
@links_1042_a
#SQL Workbench/J
@links_1043_p
#Free DBMS-independent SQL tool.
@links_1044_a
#SQuirreL SQL Client
@links_1045_p
#Graphical tool to view the structure of a database, browse the data, issue SQL commands etc.
@links_1046_a
#SQuirreL DB Copy Plugin
@links_1047_p
#Tool to copy data from one database to another.
@links_1048_h2
#Products and Projects
@links_1049_a
#Æjaks
@links_1050_p
#A server-side scripting environment to build AJAX enabled web applications.
@links_1051_a
#Axiom Stack
@links_1052_p
#A web framework that let's you write dynamic web applications with Zen-like simplicity.
@links_1053_a
#Apache Cayenne
@links_1054_p
#Open source persistence framework providing object-relational mapping (ORM) and remoting services.
@links_1055_a
#Apache Jackrabbit
@links_1056_p
#Open source implementation of the Java Content Repository API (JCR).
@links_1057_a
#Apache OpenJPA
@links_1058_p
#Open source implementation of the Java Persistence API (JPA).
@links_1059_a
#AppFuse
@links_1060_p
#Helps building web applications.
@links_1061_a
#BGBlitz
@links_1062_p
#The Swiss army knife of Backgammon.
@links_1063_a
#Blojsom
@links_1064_p
#Java-based multi-blog, multi-user software package (Mac OS X Weblog Server).
@links_1065_a
#Bookmarks Portlet
@links_1066_p
#JSR 168 compliant bookmarks management portlet application.
@links_1067_a
#Claros inTouch
@links_1068_p
#Ajax communication suite with mail, addresses, notes, IM, and rss reader.
@links_1069_a
#CrashPlan PRO Server
@links_1070_p
#Easy and cross platform backup solution for business and service providers.
@links_1071_a
#DbUnit
@links_1072_p
#A JUnit extension (also usable with Ant) targeted for database-driven projects.
@links_1073_a
#Ebean ORM Persistence Layer
@links_1074_p
#Open source Java Object Relational Mapping tool.
@links_1075_a
#Epictetus
@links_1076_p
#Free cross platform database tool.
@links_1077_a
#Fabric3
@links_1078_p
#Fabric3 is a project implementing a federated service network based on the Service Component Architecture specification (http://www.osoa.org).
@links_1079_a
#FIT4Data
@links_1080_p
#A testing framework for data management applications built on the Java implementation of FIT.
@links_1081_a
#Flux
@links_1082_p
#Java job scheduler, file transfer, workflow, and BPM.
@links_1083_a
#GNU Gluco Control
@links_1084_p
#Helps you to manage your diabetes..
@links_1085_a
#Golden T Studios
@links_1086_p
#Fun-to-play games with a simple interface.
@links_1087_a
#Group Session
@links_1088_p
#Open source web groupware.
@links_1089_a
#HA-JDBC
@links_1090_p
#High-Availability JDBC: A JDBC proxy that provides light-weight, transparent, fault tolerant clustering capability to any underlying JDBC driver.
@links_1091_a
#Harbor
@links_1092_p
#Pojo Application Server.
@links_1093_a
#Hibernate
@links_1094_p
#Relational persistence for idiomatic Java (O-R mapping tool).
@links_1095_a
#Hibicius
@links_1096_p
#Online Banking Client for the HBCI protocol.
@links_1097_a
#ImageMapper
@links_1098_p
#ImageMapper frees users from having to use file browsers to view their images. They get fast access to images and easy cataloguing of them via a user friendly interface.
@links_1099_a
#JAMWiki
@links_1100_p
#Java-based Wiki engine.
@links_1101_a
#Jala
@links_1102_p
#Open source collection of JavaScript modules.
@links_1103_a
#Java Simon
@links_1104_p
#Simple Monitoring API.
@links_1105_a
#jBPM
@links_1106_p
#A platform for executable process languages ranging from business process management (BPM) over workflow to service orchestration.
@links_1107_a
#JGeocoder
@links_1108_p
#Free Java geocoder. Geocoding is the process of estimating a latitude and longitude for a given location.
@links_1109_a
#JGrass
@links_1110_p
#Java Geographic Resources Analysis Support System. Free, multi platform, open source GIS based on the GIS framework of uDig.
@links_1111_a
#Jena
@links_1112_p
#Java framework for building Semantic Web applications.
@links_1113_a
#JMatter
@links_1114_p
#Framework for constructing workgroup business applications based on the Naked Objects Architectural Pattern.
@links_1115_a
#JotBot
@links_1116_p
#Records your day at user defined intervals.
@links_1117_a
#JPOX
@links_1118_p
#Java persistent objects.
@links_1119_a
#Liftweb
@links_1120_p
#A Scala-based, secure, developer friendly web framework.
@links_1121_a
#LiquiBase
@links_1122_p
#A tool to manage database changes and refactorings.
@links_1123_a
#Luntbuild
@links_1124_p
#Build automation and management tool.
@links_1125_a
#Magnolia
@links_1126_p
#Microarray Data Management and Export System for PFGRC (Pathogen Functional Genomics Resource Center) Microarrays.
@links_1127_a
#MiniConnectionPoolManager
@links_1128_p
#A lightweight standalone JDBC connection pool manager.
@links_1129_a
#Mr. Persister
@links_1130_p
#Simple, small and fast object relational mapping.
@links_1131_a
#Myna Application Server
@links_1132_p
#Java web app that provides dynamic web content and Java libraries access from JavaScript.
@links_1133_a
#MyTunesRss
@links_1134_p
#MyTunesRSS lets you listen to your music wherever you are.
@links_1135_a
#NCGC CurveFit
@links_1136_p
#From: NIH Chemical Genomics Center, National Institutes of Health, USA. An open source application in the life sciences research field. This application handles chemical structures and biological responses of thousands of compounds with the potential to handle million+ compounds. It utilizes an embedded H2 database to enable flexible query/retrieval of all data including advanced chemical substructure and similarity searching. The application highlights an automated curve fitting and classification algorithm that outperforms commercial packages in the field. Commercial alternatives are typically small desktop software that handle a few dose response curves at a time. A couple of commercial packages that do handle several thousand curves are very expensive tools (>60k USD) that require manual curation of analysis by the user; require a license to Oracle; lack advanced query/retrieval; and the ability to handle chemical structures.
@links_1137_a
#Nuxeo
@links_1138_p
#Standards-based, open source platform for building ECM applications.
@links_1139_a
#nWire
@links_1140_p
#Eclipse plug-in which expedites Java development. It's main purpose is to help developers find code quicker and easily understand how it relates to the rest of the application, thus, understand the application structure.
@links_1141_a
#Ontology Works
@links_1142_p
#This company provides semantic technologies including deductive information repositories (the Ontology Works Knowledge Servers), semantic information fusion and semantic federation of legacy databases, ontology-based domain modeling, and management of the distributed enterprise.
@links_1143_a
#Ontoprise OntoBroker
@links_1144_p
#SemanticWeb-Middleware. It supports all W3C Semantic Web recommendations: OWL, RDF, RDFS, SPARQL, and F-Logic.
@links_1145_a
#Open Anzo
@links_1146_p
#Semantic Application Server.
@links_1147_a
#OpenGroove
@links_1148_p
#OpenGroove is a groupware program that allows users to synchronize data.
@links_1149_a
#Orion
@links_1150_p
#J2EE Application Server.
@links_1151_a
#P5H2
@links_1152_p
#A library for the Processing programming language and environment.
@links_1153_a
#Phase-6
@links_1154_p
#A computer based learning software.
@links_1155_a
#Pickle
@links_1156_p
#Pickle is a Java library containing classes for persistence, concurrency, and logging.
@links_1157_a
#Piman
@links_1158_p
#Water treatment projects data management.
@links_1159_a
#PolePosition
@links_1160_p
#Open source database benchmark.
@links_1161_a
#Poormans
@links_1162_p
#Very basic CMS running as a SWT application and generating static html pages.
@links_1163_a
#Railo
@links_1164_p
#Railo is an alternative engine for the Cold Fusion Markup Language, that compiles code programmed in CFML into Java bytecode and executes it on a servlet engine.
@links_1165_a
#Razuna
@links_1166_p
#Open source Digital Asset Management System with integrated Web Content Management.
@links_1167_a
#RIFE
@links_1168_p
#A full-stack web application framework with tools and APIs to implement most common web features.
@links_1169_a
#Rutema
@links_1170_p
#Rutema is a test execution and management tool for heterogeneous development environments written in Ruby.
@links_1171_a
#Sava
@links_1172_p
#Open-source web-based content management system.
@links_1173_a
#Scriptella
@links_1174_p
#ETL (Extract-Transform-Load) and script execution tool.
@links_1175_a
#Sesar
@links_1176_p
#Dependency Injection Container with Aspect Oriented Programming.
@links_1177_a
#SemmleCode
@links_1178_p
#Eclipse plugin to help you improve software quality.
@links_1179_a
#SeQuaLite
@links_1180_p
#A free, light-weight, java data access framework.
@links_1181_a
#ShapeLogic
@links_1182_p
#Toolkit for declarative programming, image processing and computer vision.
@links_1183_a
#Shellbook
@links_1184_p
#Desktop publishing application.
@links_1185_a
#Signsoft intelliBO
@links_1186_p
#Persistence middleware supporting the JDO specification.
@links_1187_a
#SimpleORM
@links_1188_p
#Simple Java Object Relational Mapping.
@links_1189_a
#SymmetricDS
@links_1190_p
#A web-enabled, database independent, data synchronization/replication software.
@links_1191_a
#SmartFoxServer
@links_1192_p
#Platform for developing multiuser applications and games with Macromedia Flash.
@links_1193_a
#Social Bookmarks Friend Finder
@links_1194_p
#A GUI application that allows you to find users with similar bookmarks to the user specified (for delicious.com).
@links_1195_a
#Springfuse
@links_1196_p
#Code generation For Spring, Spring MVC & Hibernate.
@links_1197_a
#SQLOrm
@links_1198_p
#Java Object Relation Mapping.
@links_1199_a
#StorYBook
@links_1200_p
#A summary-based tool for novelist and script writers. It helps to keep the overview over the various traces a story has.
@links_1201_a
#StreamCruncher
@links_1202_p
#Event (stream) processing kernel.
@links_1203_a
#Tune Backup
@links_1204_p
#Easy-to-use backup solution for your iTunes library.
@links_1205_a
#weblica
@links_1206_p
#Desktop CMS.
@links_1207_a
#Web of Web
@links_1208_p
#Collaborative and realtime interactive media platform for the web.
@links_1209_a
#Werkzeugkasten
@links_1210_p
#Minimum Java Toolset.
@links_1211_a
#VPDA
@links_1212_p
#View providers driven applications is a Java based application framework for building applications composed from server components - view providers.
@links_1213_a
#Volunteer database
@links_1214_p
#A database front end to register volunteers, partnership and donation for a Non Profit organization.
@mainWeb_1000_h1
H2 データベース エンジン
@mainWeb_1001_p
#Welcome to H2, the Java SQL database. The main feature of H2 are:
@mainWeb_1002_li
#Very fast, open source, JDBC and ODBC API
@mainWeb_1003_li
#Embedded, server and cluster modes; in-memory databases
@mainWeb_1004_li
#Browser based Console application
@mainWeb_1005_li
#Small footprint: around 1 MB jar file size
@mainWeb_1006_h3
ダウンロード
@mainWeb_1007_td
#Version 1.1.108 (2009-02-28):
@mainWeb_1008_a
#Windows Installer (3.3 MB)
@mainWeb_1009_a
#All Platforms (zip, 4.9 MB)
@mainWeb_1010_a
#All Downloads
@mainWeb_1011_td
@mainWeb_1012_h3
サポート
@mainWeb_1013_a
Google グループ (English)
@mainWeb_1014_a
Google グループ (Japanese)
@mainWeb_1015_p
e-mail はこちらから:
@mainWeb_1016_h3
パフォーマンス
@mainWeb_1017_td
操作/秒 (高い方がより良い) - このテストについての詳しい情報
@mainWeb_1018_h3
ニュース
@mainWeb_1019_b
ニュースフィード:
@mainWeb_1020_a
#Full text (Atom)
@mainWeb_1021_p
#or Header only (RSS) .
@mainWeb_1022_b
Email ニュースレター:
@mainWeb_1023_p
H2 データベース ニュース (Googleアカウントが必要です)
に署名し、ニューリリースについての情報を入手して下さい。
あなたのemailアドレスはこのコンテンツでのみ使用されます。
@mainWeb_1024_td
@mainWeb_1025_h3
寄稿する
@mainWeb_1026_p
#You can contribute to the development of H2 by sending feedback and bug reports, or translate the H2 Console application (for details, start the H2 Console and select Options / Translate). To donate money, click on the PayPal button below. You will be listed as a supporter:
@main_1000_h1
H2 データベース エンジン
@main_1001_p
ようこそ、無料のSQLデータベース、H2へ
@main_1002_a
クイックスタート
@main_1003_p
#Get a fast overview.
@main_1004_a
チュートリアル
@main_1005_p
Go through the samples.
@main_1006_a
特徴
@main_1007_p
See what this database can do and how to use these features.
@performance_1000_h1
パフォーマンス
@performance_1001_a
#Performance Comparison
@performance_1002_a
#PolePosition Benchmark
@performance_1003_a
#Application Profiling
@performance_1004_a
#Database Profiling
@performance_1005_a
#Performance Tuning
@performance_1006_h2
#Performance Comparison
@performance_1007_p
#In most cases H2 is a lot faster than all other (open source and not open source) database engines. Please note this is mostly a single connection benchmark run on one computer.
@performance_1008_h3
#Embedded
@performance_1009_th
#Test Case
@performance_1010_th
#Unit
@performance_1011_th
H2
@performance_1012_th
HSQLDB
@performance_1013_th
Derby
@performance_1014_td
#Simple: Init
@performance_1015_td
#ms
@performance_1016_td
#610
@performance_1017_td
#657
@performance_1018_td
#3187
@performance_1019_td
#Simple: Query (random)
@performance_1020_td
#ms
@performance_1021_td
#297
@performance_1022_td
#312
@performance_1023_td
#1828
@performance_1024_td
#Simple: Query (sequential)
@performance_1025_td
#ms
@performance_1026_td
#203
@performance_1027_td
#266
@performance_1028_td
#1766
@performance_1029_td
#Simple: Update (random)
@performance_1030_td
#ms
@performance_1031_td
#1078
@performance_1032_td
#1484
@performance_1033_td
#22031
@performance_1034_td
#Simple: Delete (sequential)
@performance_1035_td
#ms
@performance_1036_td
#234
@performance_1037_td
#281
@performance_1038_td
#7407
@performance_1039_td
#Simple: Memory Usage
@performance_1040_td
#MB
@performance_1041_td
#6
@performance_1042_td
#7
@performance_1043_td
#11
@performance_1044_td
#BenchA: Init
@performance_1045_td
#ms
@performance_1046_td
#859
@performance_1047_td
#438
@performance_1048_td
#4047
@performance_1049_td
#BenchA: Transactions
@performance_1050_td
#ms
@performance_1051_td
#5266
@performance_1052_td
#2875
@performance_1053_td
#17500
@performance_1054_td
#BenchA: Memory Usage
@performance_1055_td
#MB
@performance_1056_td
#9
@performance_1057_td
#14
@performance_1058_td
#10
@performance_1059_td
#BenchB: Init
@performance_1060_td
#ms
@performance_1061_td
#4016
@performance_1062_td
#2687
@performance_1063_td
#16875
@performance_1064_td
#BenchB: Transactions
@performance_1065_td
#ms
@performance_1066_td
#2609
@performance_1067_td
#3282
@performance_1068_td
#4250
@performance_1069_td
#BenchB: Memory Usage
@performance_1070_td
#MB
@performance_1071_td
#9
@performance_1072_td
#10
@performance_1073_td
#8
@performance_1074_td
#BenchC: Init
@performance_1075_td
#ms
@performance_1076_td
#891
@performance_1077_td
#594
@performance_1078_td
#5766
@performance_1079_td
#BenchC: Transactions
@performance_1080_td
#ms
@performance_1081_td
#4359
@performance_1082_td
#75438
@performance_1083_td
#11718
@performance_1084_td
#BenchC: Memory Usage
@performance_1085_td
#MB
@performance_1086_td
#9
@performance_1087_td
#18
@performance_1088_td
#9
@performance_1089_td
#Executed statements
@performance_1090_td
##
@performance_1091_td
#594255
@performance_1092_td
#594255
@performance_1093_td
#594255
@performance_1094_td
#Total time
@performance_1095_td
#ms
@performance_1096_td
#20422
@performance_1097_td
#88314
@performance_1098_td
#96375
@performance_1099_td
#Statements per second
@performance_1100_td
##
@performance_1101_td
#29098
@performance_1102_td
#6728
@performance_1103_td
#6166
@performance_1104_h3
#Client-Server
@performance_1105_th
#Test Case
@performance_1106_th
#Unit
@performance_1107_th
H2
@performance_1108_th
HSQLDB
@performance_1109_th
Derby
@performance_1110_th
PostgreSQL
@performance_1111_th
MySQL
@performance_1112_td
#Simple: Init
@performance_1113_td
#ms
@performance_1114_td
#3125
@performance_1115_td
#3312
@performance_1116_td
#7140
@performance_1117_td
#5109
@performance_1118_td
#3594
@performance_1119_td
#Simple: Query (random)
@performance_1120_td
#ms
@performance_1121_td
#3390
@performance_1122_td
#3328
@performance_1123_td
#9953
@performance_1124_td
#5422
@performance_1125_td
#4812
@performance_1126_td
#Simple: Query (sequential)
@performance_1127_td
#ms
@performance_1128_td
#3235
@performance_1129_td
#3219
@performance_1130_td
#9813
@performance_1131_td
#5296
@performance_1132_td
#3969
@performance_1133_td
#Simple: Update (random)
@performance_1134_td
#ms
@performance_1135_td
#3437
@performance_1136_td
#4562
@performance_1137_td
#26594
@performance_1138_td
#6766
@performance_1139_td
#5703
@performance_1140_td
#Simple: Delete (sequential)
@performance_1141_td
#ms
@performance_1142_td
#1391
@performance_1143_td
#1625
@performance_1144_td
#9343
@performance_1145_td
#2750
@performance_1146_td
#2094
@performance_1147_td
#Simple: Memory Usage
@performance_1148_td
#MB
@performance_1149_td
#7
@performance_1150_td
#7
@performance_1151_td
#13
@performance_1152_td
#0
@performance_1153_td
#1
@performance_1154_td
#BenchA: Init
@performance_1155_td
#ms
@performance_1156_td
#2781
@performance_1157_td
#2954
@performance_1158_td
#7828
@performance_1159_td
#4875
@performance_1160_td
#3859
@performance_1161_td
#BenchA: Transactions
@performance_1162_td
#ms
@performance_1163_td
#13015
@performance_1164_td
#11718
@performance_1165_td
#30031
@performance_1166_td
#17672
@performance_1167_td
#13187
@performance_1168_td
#BenchA: Memory Usage
@performance_1169_td
#MB
@performance_1170_td
#9
@performance_1171_td
#17
@performance_1172_td
#10
@performance_1173_td
#1
@performance_1174_td
#1
@performance_1175_td
#BenchB: Init
@performance_1176_td
#ms
@performance_1177_td
#12000
@performance_1178_td
#13047
@performance_1179_td
#30562
@performance_1180_td
#20687
@performance_1181_td
#15328
@performance_1182_td
#BenchB: Transactions
@performance_1183_td
#ms
@performance_1184_td
#5375
@performance_1185_td
#3688
@performance_1186_td
#8063
@performance_1187_td
#6250
@performance_1188_td
#4594
@performance_1189_td
#BenchB: Memory Usage
@performance_1190_td
#MB
@performance_1191_td
#10
@performance_1192_td
#12
@performance_1193_td
#8
@performance_1194_td
#1
@performance_1195_td
#1
@performance_1196_td
#BenchC: Init
@performance_1197_td
#ms
@performance_1198_td
#2390
@performance_1199_td
#1875
@performance_1200_td
#7015
@performance_1201_td
#2515
@performance_1202_td
#4062
@performance_1203_td
#BenchC: Transactions
@performance_1204_td
#ms
@performance_1205_td
#11391
@performance_1206_td
#77922
@performance_1207_td
#23766
@performance_1208_td
#13203
@performance_1209_td
#8141
@performance_1210_td
#BenchC: Memory Usage
@performance_1211_td
#MB
@performance_1212_td
#11
@performance_1213_td
#18
@performance_1214_td
#15
@performance_1215_td
#1
@performance_1216_td
#1
@performance_1217_td
#Executed statements
@performance_1218_td
##
@performance_1219_td
#594255
@performance_1220_td
#594255
@performance_1221_td
#594255
@performance_1222_td
#594255
@performance_1223_td
#594255
@performance_1224_td
#Total time
@performance_1225_td
#ms
@performance_1226_td
#61530
@performance_1227_td
#127250
@performance_1228_td
#170108
@performance_1229_td
#90545
@performance_1230_td
#69343
@performance_1231_td
#Statements per second
@performance_1232_td
##
@performance_1233_td
#9657
@performance_1234_td
#4669
@performance_1235_td
#3493
@performance_1236_td
#6563
@performance_1237_td
#8569
@performance_1238_h3
#Benchmark Results and Comments
@performance_1239_h4
H2
@performance_1240_p
#Version 1.0.78 (2008-08-28) was used for the test. For simpler operations, the performance of H2 is about the same as for HSQLDB. For more complex queries, the query optimizer is very important. However H2 is not very fast in every case, certain kind of queries may still be slow. One situation where is H2 is slow is large result sets, because they are buffered to disk if more than a certain number of records are returned. The advantage of buffering is, there is no limit on the result set size. The open/close time is almost fixed, because of the file locking protocol: The engine waits 20 ms after opening a database to ensure the database files are not opened by another process.
@performance_1241_h4
HSQLDB
@performance_1242_p
#Version 1.8.0.10 was used for the test. Cached tables are used in this test (hsqldb.default_table_type=cached), and the write delay is 1 second (SET WRITE_DELAY 1). HSQLDB is fast when using simple operations. HSQLDB is very slow in the last test (BenchC: Transactions), probably because is has a bad query optimizer. One query where HSQLDB is slow is a two-table join:
@performance_1243_p
#The PolePosition benchmark also shows that the query optimizer does not do a very good job for some queries. A disadvantage in HSQLDB is the slow startup / shutdown time (currently not listed) when using bigger databases. The reason is, a backup of the database is created whenever the database is opened or closed.
@performance_1244_h4
Derby
@performance_1245_p
#Version 10.4.2.0 was used for the test. Derby is clearly the slowest embedded database in this test. This seems to be a structural problem, because all operations are really slow. It will not be easy for the developers of Derby to improve the performance to a reasonable level. A few problems have been identified: Leaving autocommit on is a problem for Derby. If it is switched off during the whole test, the results are about 20% better for Derby. Derby supports a testing mode (system property derby.system.durability=test) where durability is disabled. According to the documentation, this setting should be used for testing only, as the database may not recover after a crash. Enabling this setting improves performance by a factor of 2.6 (embedded mode) or 1.4 (server mode). Even if enabled, Derby is still less than half as fast as H2 in default mode.
@performance_1246_h4
PostgreSQL
@performance_1247_p
#Version 8.3.4 was used for the test. The following options where changed in postgresql.conf: fsync = off, commit_delay = 1000. PostgreSQL is run in server mode. It looks like the base performance is slower than MySQL, the reason could be the network layer. The memory usage number is incorrect, because only the memory usage of the JDBC driver is measured.
@performance_1248_h4
MySQL
@performance_1249_p
#Version 5.0.67 was used for the test. MySQL was run with the InnoDB backend. The setting innodb_flush_log_at_trx_commit (found in the my.ini file) was set to 0. Otherwise (and by default), MySQL is really slow (around 140 statements per second in this test) because it tries to flush the data to disk for each commit. For small transactions (when autocommit is on) this is really slow. But many use cases use small or relatively small transactions. Too bad this setting is not listed in the configuration wizard, and it always overwritten when using the wizard. You need to change this setting manually in the file my.ini, and then restart the service. The memory usage number is incorrect, because only the memory usage of the JDBC driver is measured.
@performance_1250_h4
#Firebird
@performance_1251_p
#Firebird 1.5 (default installation) was tested, but the results are not published currently. It is possible to run the performance test with the Firebird database, and any information on how to configure Firebird for higher performance are welcome.
@performance_1252_h4
#Why Oracle / MS SQL Server / DB2 are Not Listed
@performance_1253_p
#The license of these databases does not allow to publish benchmark results. This doesn't mean that they are fast. They are in fact quite slow, and need a lot of memory. But you will need to test this yourself. SQLite was not tested because the JDBC driver doesn't support transactions.
@performance_1254_h3
#About this Benchmark
@performance_1255_h4
#Number of Connections
@performance_1256_p
#This is mostly a single-connection benchmark. BenchB uses multiple connections; the other tests use one connection.
@performance_1257_h4
#Real-World Tests
@performance_1258_p
#Good benchmarks emulate real-world use cases. This benchmark includes 3 test cases: A simple test case with one table and many small updates / deletes. BenchA is similar to the TPC-A test, but single connection / single threaded (see also: www.tpc.org). BenchB is similar to the TPC-B test, using multiple connections (one thread per connection). BenchC is similar to the TPC-C test, but single connection / single threaded.
@performance_1259_h4
#Comparing Embedded with Server Databases
@performance_1260_p
#This is mainly a benchmark for embedded databases (where the application runs in the same virtual machine than the database engine). However MySQL and PostgreSQL are not Java databases and cannot be embedded into a Java application. For the Java databases, both embedded and server modes are tested.
@performance_1261_h4
#Test Platform
@performance_1262_p
#This test is run on Windows XP with the virus scanner switched off. The VM used is Sun JDK 1.5.
@performance_1263_h4
#Multiple Runs
@performance_1264_p
#When a Java benchmark is run first, the code is not fully compiled and therefore runs slower than when running multiple times. A benchmark should always run the same test multiple times and ignore the first run(s). This benchmark runs three times, but only the last run is measured.
@performance_1265_h4
#Memory Usage
@performance_1266_p
#It is not enough to measure the time taken, the memory usage is important as well. Performance can be improved in databases by using a bigger in-memory cache, but there is only a limited amount of memory available on the system. HSQLDB tables are kept fully in memory by default; this benchmark uses 'disk based' tables for all databases. Unfortunately, it is not so easy to calculate the memory usage of PostgreSQL and MySQL, because they run in a different process than the test. This benchmark currently does not print memory usage of those databases.
@performance_1267_h4
#Delayed Operations
@performance_1268_p
#Some databases delay some operations (for example flushing the buffers) until after the benchmark is run. This benchmark waits between each database tested, and each database runs in a different process (sequentially).
@performance_1269_h4
#Transaction Commit / Durability
@performance_1270_p
#Durability means transaction committed to the database will not be lost. Some databases (for example MySQL) try to enforce this by default by calling fsync() to flush the buffers, but most hard drives don't actually flush all data. Calling fsync() slows down transaction commit a lot, but doesn't always make data durable. When comparing the results, it is important to think about the effect. Many database suggest to 'batch' operations when possible. This benchmark switches off autocommit when loading the data, and calls commit after each 1000 inserts. However many applications need 'short' transactions at runtime (a commit after each update). This benchmark commits after each update / delete in the simple benchmark, and after each business transaction in the other benchmarks. For databases that support delayed commits, a delay of one second is used.
@performance_1271_h4
#Using Prepared Statements
@performance_1272_p
#Wherever possible, the test cases use prepared statements.
@performance_1273_h4
#Currently Not Tested: Startup Time
@performance_1274_p
#The startup time of a database engine is important as well for embedded use. This time is not measured currently. Also, not tested is the time used to create a database and open an existing database. Here, one (wrapper) connection is opened at the start, and for each step a new connection is opened and then closed. That means the Open/Close time listed is for opening a connection if the database is already in use.
@performance_1275_h2
#PolePosition Benchmark
@performance_1276_p
#The PolePosition is an open source benchmark. The algorithms are all quite simple. It was developed / sponsored by db4o.
@performance_1277_th
#Test Case
@performance_1278_th
#Unit
@performance_1279_th
H2
@performance_1280_th
HSQLDB
@performance_1281_th
MySQL
@performance_1282_td
#Melbourne write
@performance_1283_td
#ms
@performance_1284_td
#369
@performance_1285_td
#249
@performance_1286_td
#2022
@performance_1287_td
#Melbourne read
@performance_1288_td
#ms
@performance_1289_td
#47
@performance_1290_td
#49
@performance_1291_td
#93
@performance_1292_td
#Melbourne read_hot
@performance_1293_td
#ms
@performance_1294_td
#24
@performance_1295_td
#43
@performance_1296_td
#95
@performance_1297_td
#Melbourne delete
@performance_1298_td
#ms
@performance_1299_td
#147
@performance_1300_td
#133
@performance_1301_td
#176
@performance_1302_td
#Sepang write
@performance_1303_td
#ms
@performance_1304_td
#965
@performance_1305_td
#1201
@performance_1306_td
#3213
@performance_1307_td
#Sepang read
@performance_1308_td
#ms
@performance_1309_td
#765
@performance_1310_td
#948
@performance_1311_td
#3455
@performance_1312_td
#Sepang read_hot
@performance_1313_td
#ms
@performance_1314_td
#789
@performance_1315_td
#859
@performance_1316_td
#3563
@performance_1317_td
#Sepang delete
@performance_1318_td
#ms
@performance_1319_td
#1384
@performance_1320_td
#1596
@performance_1321_td
#6214
@performance_1322_td
#Bahrain write
@performance_1323_td
#ms
@performance_1324_td
#1186
@performance_1325_td
#1387
@performance_1326_td
#6904
@performance_1327_td
#Bahrain query_indexed_string
@performance_1328_td
#ms
@performance_1329_td
#336
@performance_1330_td
#170
@performance_1331_td
#693
@performance_1332_td
#Bahrain query_string
@performance_1333_td
#ms
@performance_1334_td
#18064
@performance_1335_td
#39703
@performance_1336_td
#41243
@performance_1337_td
#Bahrain query_indexed_int
@performance_1338_td
#ms
@performance_1339_td
#104
@performance_1340_td
#134
@performance_1341_td
#678
@performance_1342_td
#Bahrain update
@performance_1343_td
#ms
@performance_1344_td
#191
@performance_1345_td
#87
@performance_1346_td
#159
@performance_1347_td
#Bahrain delete
@performance_1348_td
#ms
@performance_1349_td
#1215
@performance_1350_td
#729
@performance_1351_td
#6812
@performance_1352_td
#Imola retrieve
@performance_1353_td
#ms
@performance_1354_td
#198
@performance_1355_td
#194
@performance_1356_td
#4036
@performance_1357_td
#Barcelona write
@performance_1358_td
#ms
@performance_1359_td
#413
@performance_1360_td
#832
@performance_1361_td
#3191
@performance_1362_td
#Barcelona read
@performance_1363_td
#ms
@performance_1364_td
#119
@performance_1365_td
#160
@performance_1366_td
#1177
@performance_1367_td
#Barcelona query
@performance_1368_td
#ms
@performance_1369_td
#20
@performance_1370_td
#5169
@performance_1371_td
#101
@performance_1372_td
#Barcelona delete
@performance_1373_td
#ms
@performance_1374_td
#388
@performance_1375_td
#319
@performance_1376_td
#3287
@performance_1377_td
#Total
@performance_1378_td
#ms
@performance_1379_td
#26724
@performance_1380_td
#53962
@performance_1381_td
#87112
@performance_1382_p
#There are a few problems with the PolePosition test:
@performance_1383_li
#HSQLDB uses in-memory tables by default while H2 uses persistent tables. The HSQLDB version included in PolePosition does not support changing this, so you need to replace poleposition-0.20/lib/hsqldb.jar with a newer version (for example hsqldb-1.8.0.7.jar), and then use the setting hsqldb.connecturl=jdbc:hsqldb:file:data/hsqldb/dbbench2;hsqldb.default_table_type=cached;sql.enforce_size=true in Jdbc.properties.
@performance_1384_li
#HSQLDB keeps the database open between tests, while H2 closes the database (losing all the cache). To change that, use the database URL jdbc:h2:file:data/h2/dbbench;DB_CLOSE_DELAY=-1
@performance_1385_li
#The amount of cache memory is quite important, specially for the PolePosition test. Unfortunately, the PolePosition test does not take this into account.
@performance_1386_h2
#Application Profiling
@performance_1387_h3
#Analyze First
@performance_1388_p
#Before trying to optimize the performance, it is important to know where the time is actually spent. The same is true for memory problems. Premature or 'blind' optimization should be avoided, as it is not an efficient way to solve the problem. There are various ways to analyze the application. In some situations it is possible to compare two implementations and use System.currentTimeMillis() to find out which one is faster. But this does not work for complex applications with many modules, and for memory problems.
@performance_1389_p
#A very good tool to measure both the memory and the CPU is the YourKit Java Profiler . This tool is also used to optimize the performance and memory footprint of this database engine.
@performance_1390_p
#A simple way to profile an application is to use the built-in profiling tool of java. Example:
@performance_1391_p
#Unfortunately, it is only possible to profile the application from start to end.
@performance_1392_h2
#Database Profiling
@performance_1393_p
#The ConvertTraceFile tool generates SQL statement statistics at the end of the SQL script file. The format used is similar to the profiling data generated when using java -Xrunhprof. As an example, execute the the following script using the H2 Console:
@performance_1394_p
#Now convert the .trace.db file using the ConvertTraceFile tool:
@performance_1395_p
#The generated file test.sql
will contain the SQL statements as well as the following profiling data (results vary):
@performance_1396_h2
#Database Performance Tuning
@performance_1397_h3
#Virus Scanners
@performance_1398_p
#Some virus scanners scan files every time they are accessed. It is very important for performance that database files are not scanned for viruses. The database engine does never interprets the data stored in the files as programs, that means even if somebody would store a virus in a database file, this would be harmless (when the virus does not run, it cannot spread). Some virus scanners allow excluding file endings. Make sure files ending with .db are not scanned.
@performance_1399_h3
トレースオプションを使用する
@performance_1400_p
#If the main performance hot spots are in the database engine, in many cases the performance can be optimized by creating additional indexes, or changing the schema. Sometimes the application does not directly generate the SQL statements, for example if an O/R mapping tool is used. To view the SQL statements and JDBC API calls, you can use the trace options. For more information, see Using the Trace Options .
@performance_1401_h3
#Index Usage
@performance_1402_p
#This database uses indexes to improve the performance of SELECT, UPDATE and DELETE statements. If a column is used in the WHERE clause of a query, and if an index exists on this column, then the index can be used. Multi-column indexes are used if all or the first columns of the index are used. Both equality lookup and range scans are supported. Indexes are not used to order result sets: The results are sorted in memory if required. Indexes are created automatically for primary key and unique constraints. Indexes are also created for foreign key constraints, if required. For other columns, indexes need to be created manually using the CREATE INDEX statement.
@performance_1403_h3
#Optimizer
@performance_1404_p
#This database uses a cost based optimizer. For simple and queries and queries with medium complexity (less than 7 tables in the join), the expected cost (running time) of all possible plans is calculated, and the plan with the lowest cost is used. For more complex queries, the algorithm first tries all possible combinations for the first few tables, and the remaining tables added using a greedy algorithm (this works well for most joins). Afterwards a genetic algorithm is used to test at most 2000 distinct plans. Only left-deep plans are evaluated.
@performance_1405_h3
#Expression Optimization
@performance_1406_p
#After the statement is parsed, all expressions are simplified automatically if possible. Operations are evaluated only once if all parameters are constant. Functions are also optimized, but only if the function is constant (always returns the same result for the same parameter values). If the WHERE clause is always false, then the table is not accessed at all.
@performance_1407_h3
#COUNT(*) Optimization
@performance_1408_p
#If the query only counts all rows of a table, then the data is not accessed. However, this is only possible if no WHERE clause is used, that means it only works for queries of the form SELECT COUNT(*) FROM table.
@performance_1409_h3
#Updating Optimizer Statistics / Column Selectivity
@performance_1410_p
#When executing a query, at most one index per joined table can be used. If the same table is joined multiple times, for each join only one index is used. Example: for the query SELECT * FROM TEST T1, TEST T2 WHERE T1.NAME='A' AND T2.ID=T1.ID, two index can be used, in this case the index on NAME for T1 and the index on ID for T2.
@performance_1411_p
#If a table has multiple indexes, sometimes more than one index could be used. Example: if there is a table TEST(ID, NAME, FIRSTNAME) and an index on each column, then two indexes could be used for the query SELECT * FROM TEST WHERE NAME='A' AND FIRSTNAME='B', the index on NAME or the index on FIRSTNAME. It is not possible to use both indexes at the same time. Which index is used depends on the selectivity of the column. The selectivity describes the 'uniqueness' of values in a column. A selectivity of 100 means each value appears only once, and a selectivity of 1 means the same value appears in many or most rows. For the query above, the index on NAME should be used if the table contains more distinct names than first names.
@performance_1412_p
#The SQL statement ANALYZE can be used to automatically estimate the selectivity of the columns in the tables. This command should be run from time to time to improve the query plans generated by the optimizer.
@performance_1413_h3
#Optimization Examples
@performance_1414_p
#See src/test/org/h2/samples/optimizations.sql
for a few examples of queries that benefit from special optimizations built into the database.
@quickstart_1000_h1
クイックスタート
@quickstart_1001_a
アプリケーションのエンベッドH2
@quickstart_1002_a
H2 コンソール アプリケーション
@quickstart_1003_h2
アプリケーションのエンベッドH2
@quickstart_1004_p
このデータベースはエンベッドモード、またはサーバーモードで使用可能です。エンベッドモードで使用する場合、以下を行う必要があります:
@quickstart_1005_li
#Add the h2*.jar
to the classpath
@quickstart_1006_li
JDBCドライバークラスを使用する: org.h2.Driver
@quickstart_1007_li
データベースURL jdbc:h2:~/test
ユーザーホームディレクトリ内の "test" でデータベースを開く
@quickstart_1008_li
#A new database is automatically created
@quickstart_1009_h2
H2 コンソール アプリケーション
@quickstart_1010_p
このコンソールはブラウザインターフェースを使ってSQL データベースにアクセスします。
@quickstart_1011_p
Windows XPをご使用でなかったり、期待通りに機能しない場合は、チュートリアル内の詳細説明をご覧下さい。
@quickstart_1012_h3
手順
@quickstart_1013_h4
インストール
@quickstart_1014_p
Windows インストーラーを使用してソフトウェアをインストールしましょう (まだインストールされていない場合)。
@quickstart_1015_h4
コンソールを起動する
@quickstart_1016_p
#Click [Start], [All Programs], [H2], and [H2 Console (Command Line)]:
@quickstart_1017_p
コンソールウィンドウが 開きます:
@quickstart_1018_p
#Also, a new browser page should open with the URL http://localhost:8082 . You may get a security warning from the firewall. If you don't want other computers in the network to access the database on your machine, you can let the firewall block these connections. Only local connections are required at this time.
@quickstart_1019_h4
ログイン
@quickstart_1020_p
#Select [Generic H2] and click [Connect]:
@quickstart_1021_p
ログインされました。
@quickstart_1022_h4
サンプル
@quickstart_1023_p
#Click on the [Sample SQL Script]:
@quickstart_1024_p
SQLコマンドがコマンドエリアに表示されます。
@quickstart_1025_h4
実行する
@quickstart_1026_p
#Click [Run]
@quickstart_1027_p
左側のデータベースアイコンの下に、 新しいテーブル TEST が追加されます。動作とステートメントの結果は、スクリプトの下に表示されます。
@quickstart_1028_h4
切断
@quickstart_1029_p
#Click on [Disconnect]:
@quickstart_1030_p
データベースを閉じます
@quickstart_1031_h4
終了
@quickstart_1032_p
コンソールウィンドウを閉じます。詳細はチュートリアルをご覧下さい。
@roadmap_1000_h1
ロードマップ
@roadmap_1001_p
#New (feature) requests will usually be added at the very end of the list. The priority is increased for important and popular requests. Of course, patches are always welcome, but are not always applied as is. Patches should include test cases and documentation.
@roadmap_1002_h2
#Priority 1
@roadmap_1003_li
#Bugfixes
@roadmap_1004_li
#Page store: new storage mechanism
@roadmap_1005_li
#[Requires page store] Support large updates (use the transaction log to undo).
@roadmap_1006_li
#[Requires page store] Shutdown compact
@roadmap_1007_li
#More tests with MULTI_THREADED=1
@roadmap_1008_li
#RECOVER=1 should automatically recover, =2 should run the recovery tool if required
@roadmap_1009_li
#Optimization: result set caching (like MySQL)
@roadmap_1010_li
#Server side cursors
@roadmap_1011_h2
#Priority 2
@roadmap_1012_li
#Improve test code coverage
@roadmap_1013_li
#Fulltext search: support streaming CLOB data.
@roadmap_1014_li
#Optimize .. OR .. to IN(..) or UNION if the cost is lower
@roadmap_1015_li
#Support OSGi: http://oscar-osgi.sourceforge.net, http://incubator.apache.org/felix/index.html
@roadmap_1016_li
#Test multi-threaded in-memory db access
@roadmap_1017_li
#MVCC: Select for update should only lock the selected rows.
@roadmap_1018_li
#Procedural language / script language (Javascript)
@roadmap_1019_li
#Option to shutdown all the running servers (on the same VM).
@roadmap_1020_li
#Optimize ID=? OR ID=?: convert to IN(...)
@roadmap_1021_li
#Index organized tables CREATE TABLE...(...) ORGANIZATION INDEX (store in data file) (probably file format changes are required for rowId)
@roadmap_1022_li
#Better space re-use in the files after deleting data: shrink the data file without closing the database (if the end of the file is empty)
@roadmap_1023_li
#Implement INSTEAD OF trigger (for views, tables, metadata tables).
@roadmap_1024_li
#Full outer joins
@roadmap_1025_li
#Support trigger on the tables information_schema.tables and ...columns
@roadmap_1026_li
#Test very large databases and LOBs (up to 256 GB)
@roadmap_1027_li
#Support hints for the optimizer (which index to use, enforce the join order).
@roadmap_1028_li
#Change LOB mechanism (less files, keep index of lob files, point to files and row, delete unused files earlier, maybe bundle files into a tar file)
@roadmap_1029_li
#Clustering: recovery needs to becomes fully automatic. Global write lock feature.
@roadmap_1030_li
#Option for Java functions: [DETERMINISTIC] FOR ...
@roadmap_1031_li
#Support mixed clustering mode (one embedded, the other server mode)
@roadmap_1032_li
#Sequence: add features [NO] MINVALUE, MAXVALUE, CYCLE
@roadmap_1033_li
#Deferred integrity checking (DEFERRABLE INITIALLY DEFERRED)
@roadmap_1034_li
#Groovy Stored Procedures (http://groovy.codehaus.org/Groovy+SQL)
@roadmap_1035_li
#Add a migration guide (list differences between databases)
@roadmap_1036_li
#Migrate database tool (also from other database engines)
@roadmap_1037_li
#Optimization: automatic index creation suggestion using the trace file?
@roadmap_1038_li
#Compression performance: don't allocate buffers, compress / expand in to out buffer
@roadmap_1039_li
#Rebuild index functionality (other than delete the index file)
@roadmap_1040_li
#Don't use deleteOnExit (bug 4513817: File.deleteOnExit consumes memory)
@roadmap_1041_li
#Console: add accesskey to most important commands (A, AREA, BUTTON, INPUT, LABEL, LEGEND, TEXTAREA)
@roadmap_1042_li
#Feature: a setting to delete the the log or not (for backup)
@roadmap_1043_li
#Test with Sun ASPE1_4; JEE Sun AS PE1.4
@roadmap_1044_li
#Support nested outer joins (see todo.txt).
@roadmap_1045_li
#Don't write stack traces for common exceptions like duplicate key to the log by default
@roadmap_1046_li
#Test performance again with SQL Server, Oracle, DB2
@roadmap_1047_li
#Test with dbmonster (http://dbmonster.kernelpanic.pl/)
@roadmap_1048_li
#Test with dbcopy (http://dbcopyplugin.sourceforge.net)
@roadmap_1049_li
#Test with Spatial DB in a box / JTS: http://www.opengeospatial.org/standards/sfs - OpenGIS Implementation Specification
@roadmap_1050_li
#Write more tests and documentation for MVCC (Multi Version Concurrency Control)
@roadmap_1051_li
#Find a tool to view large text file (larger than 100 MB), with find, page up and down (like less), truncate before / after
@roadmap_1052_li
#Implement, test, document XAConnection and so on
@roadmap_1053_li
#Pluggable data type (for compression, validation, conversion, encryption)
@roadmap_1054_li
#CHECK: find out what makes CHECK=TRUE slow, move to CHECK2
@roadmap_1055_li
#Improve recovery: improve code for log recovery problems (less try/catch)
@roadmap_1056_li
#Index usage for (ID, NAME)=(1, 'Hi'); document
@roadmap_1057_li
#Suggestion: include Jetty as Servlet Container (like LAMP)
@roadmap_1058_li
#Trace shipping to server
@roadmap_1059_li
#Version check: docs / web console (using Javascript), and maybe in the library (using TCP/IP)
@roadmap_1060_li
#Web server classloader: override findResource / getResourceFrom
@roadmap_1061_li
#Cost for embedded temporary view is calculated wrong, if result is constant
@roadmap_1062_li
#Comparison: pluggable sort order: natural sort
@roadmap_1063_li
#Count index range query (count(*) where id between 10 and 20)
@roadmap_1064_li
#Eclipse plugin
@roadmap_1065_li
#Asynchronous queries to support publish/subscribe: SELECT ... FOR READ WAIT [maxMillisToWait]
@roadmap_1066_li
#Improved fulltext search (reader / tokenizer / filter).
@roadmap_1067_li
#Linked schema using CSV files: one schema for a directory of files; support indexes for CSV files
@roadmap_1068_li
#iReport to support H2
@roadmap_1069_li
#Implement missing JDBC API (CallableStatement,...)
@roadmap_1070_li
#Compression of the cache
@roadmap_1071_li
#Include SMPT (mail) server (at least client) (alert on cluster failure, low disk space,...)
@roadmap_1072_li
#Drop with restrict (currently cascade is the default)
@roadmap_1073_li
#JSON parser and functions
@roadmap_1074_li
#Automatic collection of statistics (auto ANALYZE)
@roadmap_1075_li
#Server: client ping from time to time (to avoid timeout - is timeout a problem?)
@roadmap_1076_li
#Copy database: Tool with config GUI and batch mode, extensible (example: compare)
@roadmap_1077_li
#Document, implement tool for long running transactions using user-defined compensation statements
@roadmap_1078_li
#Support SET TABLE DUAL READONLY
@roadmap_1079_li
#GCJ: what is the state now?
@roadmap_1080_li
#Reduce disk space usage
@roadmap_1081_li
#Events for: Database Startup, Connections, Login attempts, Disconnections, Prepare (after parsing), Web Server (see http://docs.openlinksw.com/virtuoso/fn_dbev_startup.html)
@roadmap_1082_li
#Optimization: Log compression
@roadmap_1083_li
#Support standard INFORMATION_SCHEMA tables, as defined in http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt; specially KEY_COLUMN_USAGE (http://dev.mysql.com/doc/refman/5.0/en/information-schema.html, http://www.xcdsql.org/Misc/INFORMATION_SCHEMA%20With%20Rolenames.gif)
@roadmap_1084_li
#Compatibility: in MySQL, HSQLDB, /0.0 is NULL; in PostgreSQL, Derby: Division by zero
@roadmap_1085_li
#Functional tables should accept parameters from other tables (see FunctionMultiReturn) SELECT * FROM TEST T, P2C(T.A, T.R)
@roadmap_1086_li
#Custom class loader to reload functions on demand
@roadmap_1087_li
#Test http://mysql-je.sourceforge.net/
@roadmap_1088_li
#Close all files when closing the database (including LOB files that are open on the client side)
@roadmap_1089_li
#EXE file: maybe use http://jsmooth.sourceforge.net
@roadmap_1090_li
#Performance: Automatically build in-memory indexes if the whole table is in memory
@roadmap_1091_li
#H2 Console: The webclient could support more features like phpMyAdmin.
@roadmap_1092_li
#Use Janino to convert Java to C++
@roadmap_1093_li
#The HELP information schema can be directly exposed in the Console
@roadmap_1094_li
#Maybe use the 0x1234 notation for binary fields, see MS SQL Server
@roadmap_1095_li
#Support Oracle CONNECT BY in some way: http://www.adp-gmbh.ch/ora/sql/connect_by.html, http://philip.greenspun.com/sql/trees.html
@roadmap_1096_li
#SQL Server 2005, Oracle: Support COUNT(*) OVER(). See http://www.orafusion.com/art_anlytc.htm
@roadmap_1097_li
#RANK() and DENSE_RANK(), Partition using OVER()
@roadmap_1098_li
#SQL 2003 (http://www.wiscorp.com/sql_2003_standard.zip)
@roadmap_1099_li
#http://www.jpackage.org
@roadmap_1100_li
#Version column (number/sequence and timestamp based)
@roadmap_1101_li
#Optimize getGeneratedKey: send last identity after each execute (server).
@roadmap_1102_li
#Date: default date is '1970-01-01' (is it 1900-01-01 in the standard / other databases?)
@roadmap_1103_li
#Test and document UPDATE TEST SET (ID, NAME) = (SELECT ID*10, NAME || '!' FROM TEST T WHERE T.ID=TEST.ID);
@roadmap_1104_li
#Max memory rows / max undo log size: use block count / row size not row count
@roadmap_1105_li
#Support 123L syntax as in Java; example: SELECT (2000000000*2)
@roadmap_1106_li
#Implement point-in-time recovery
@roadmap_1107_li
#Include the version name in the jar file name
@roadmap_1108_li
#LIKE: improved version for larger texts (currently using naive search)
@roadmap_1109_li
#The Script tool should work with other databases as well
@roadmap_1110_li
#Automatically convert to the next 'higher' data type whenever there is an overflow.
@roadmap_1111_li
#Throw an exception when the application calls getInt on a Long (optional)
@roadmap_1112_li
#Default date format for input and output (local date constants)
@roadmap_1113_li
#ValueInt.convertToString and so on (remove Value.convertTo)
@roadmap_1114_li
#Support custom Collators
@roadmap_1115_li
#Document ROWNUM usage for reports: SELECT ROWNUM, * FROM (subquery)
@roadmap_1116_li
#Clustering: Reads should be randomly distributed or to a designated database on RAM
@roadmap_1117_li
#Clustering: When a database is back alive, automatically synchronize with the master
@roadmap_1118_li
#Standalone tool to get relevant system properties and add it to the trace output.
@roadmap_1119_li
#Support 'call proc(1=value)' (PostgreSQL, Oracle)
@roadmap_1120_li
#JAMon (proxy jdbc driver)
@roadmap_1121_li
#Console: Improve editing data (Tab, Shift-Tab, Enter, Up, Down, Shift+Del?)
@roadmap_1122_li
#Console: Autocomplete Ctrl+Space inserts template
@roadmap_1123_li
#Simplify translation ('Donate a translation')
@roadmap_1124_li
#Option to encrypt .trace.db file
@roadmap_1125_li
#Write Behind Cache on SATA leads to data corruption See also http://sr5tech.com/write_back_cache_experiments.htm and http://www.jasonbrome.com/blog/archives/2004/04/03/writecache_enabled.html
@roadmap_1126_li
#Functions with unknown return or parameter data types: serialize / deserialize
@roadmap_1127_li
#Test if idle TCP connections are closed, and how to disable that
@roadmap_1128_li
#Try using a factory for Row, Value[] (faster?), http://javolution.org/, alternative ObjectArray / IntArray
@roadmap_1129_li
#Auto-Update feature for database, .jar file
@roadmap_1130_li
#ResultSet SimpleResultSet.readFromURL(String url): id varchar, state varchar, released timestamp
@roadmap_1131_li
#ROW_NUMBER (not the same as ROWNUM)
@roadmap_1132_li
#Partial indexing (see PostgreSQL)
@roadmap_1133_li
#The build should fail if the test fails
@roadmap_1134_li
#Add GUI to build a custom version (embedded, fulltext,...) using build flags
@roadmap_1135_li
#http://rubyforge.org/projects/hypersonic/
@roadmap_1136_li
#DbVisualizer profile for H2
@roadmap_1137_li
#Add comparator (x === y) : (x = y or (x is null and y is null))
@roadmap_1138_li
#Try to create trace file even for read only databases
@roadmap_1139_li
#Add a sample application that runs the H2 unit test and writes the result to a file (so it can be included in the user app)
@roadmap_1140_li
#Count on a column that can not be null would be optimized to COUNT(*)
@roadmap_1141_li
#Table order: ALTER TABLE TEST ORDER BY NAME DESC (MySQL compatibility)
@roadmap_1142_li
#Backup tool should work with other databases as well
@roadmap_1143_li
#Console: -ifExists doesn't work for the console. Add a flag to disable other dbs
@roadmap_1144_li
#Performance: Update in-place
@roadmap_1145_li
#Check if 'FSUTIL behavior set disablelastaccess 1' improves the performance (fsutil behavior query disablelastaccess)
@roadmap_1146_li
#Java static code analysis: http://pmd.sourceforge.net/
@roadmap_1147_li
#Java static code analysis: http://www.eclipse.org/tptp/
@roadmap_1148_li
#Compatibility for CREATE SCHEMA AUTHORIZATION
@roadmap_1149_li
#Implement Clob / Blob truncate and the remaining functionality
@roadmap_1150_li
#Maybe close LOBs after closing connection
@roadmap_1151_li
#Tree join functionality
@roadmap_1152_li
#Support alter table add column if table has views defined
@roadmap_1153_li
#Add multiple columns at the same time with ALTER TABLE .. ADD .. ADD ..
@roadmap_1154_li
#Add H2 to Gem (Ruby install system)
@roadmap_1155_li
#API for functions / user tables
@roadmap_1156_li
#Order conditions inside AND / OR to optimize the performance
@roadmap_1157_li
#Support linked JCR tables
@roadmap_1158_li
#Make sure H2 is supported by Execute Query: http://executequery.org/
@roadmap_1159_li
#Read InputStream when executing, as late as possible (maybe only embedded mode). Problem with re-execute.
@roadmap_1160_li
#Native fulltext search: min word length; store word positions
@roadmap_1161_li
#FTP Server: Implement a client to send / receive files to server (dir, get, put)
@roadmap_1162_li
#FTP Server: Implement SFTP / FTPS
@roadmap_1163_li
#Add an option to the SCRIPT command to generate only portable / standard SQL
@roadmap_1164_li
#Test Dezign for Databases (http://www.datanamic.com)
@roadmap_1165_li
#Fast library for parsing / formatting: http://javolution.org/
@roadmap_1166_li
#Updatable Views (simple cases first)
@roadmap_1167_li
#Improve create index performance
@roadmap_1168_li
#Support ARRAY data type
@roadmap_1169_li
#Implement more JDBC 4.0 features
@roadmap_1170_li
#Support TRANSFORM / PIVOT as in MS Access
@roadmap_1171_li
#SELECT * FROM (VALUES (...), (...), ....) AS alias(f1, ...)
@roadmap_1172_li
#Support updatable views with join on primary keys (to extend a table)
@roadmap_1173_li
#Public interface for functions (not public static)
@roadmap_1174_li
#Autocomplete: if I type the name of a table that does not exist (should say: syntax not supported)
@roadmap_1175_li
#Document FTP server, including -ftpTask option to execute / kill remote processes
@roadmap_1176_li
#Eliminate undo log records if stored on disk (just one pointer per block, not per record)
@roadmap_1177_li
#Feature matrix like in i-net software .
@roadmap_1178_li
#Updatable result set on table without primary key or unique index
@roadmap_1179_li
#Use LinkedList instead of ArrayList where applicable
@roadmap_1180_li
#Support % operator (modulo)
@roadmap_1181_li
#Support 1+'2'=3, '1'+'2'='12' (MS SQL Server compatibility)
@roadmap_1182_li
#Support nested transactions
@roadmap_1183_li
#Add a benchmark for big databases, and one for many users
@roadmap_1184_li
#Compression in the result set (repeating values in the same column)
@roadmap_1185_li
#Support curtimestamp (like curtime, curdate)
@roadmap_1186_li
#Support ANALYZE {TABLE|INDEX} tableName COMPUTE|ESTIMATE|DELETE STATISTICS ptnOption options
@roadmap_1187_li
#Support Sequoia (Continuent.org)
@roadmap_1188_li
#Dynamic length numbers / special methods for DataPage.writeByte / writeShort / Ronni Nielsen
@roadmap_1189_li
#Pluggable ThreadPool, (AvalonDB / deebee / Paul Hammant)
@roadmap_1190_li
#Recursive Queries (see details)
@roadmap_1191_li
#Release locks (shared or exclusive) on demand
@roadmap_1192_li
#Support OUTER UNION
@roadmap_1193_li
#Support Parameterized Views (similar to CSVREAD, but using just SQL for the definition)
@roadmap_1194_li
#A way (JDBC driver) to map an URL (jdbc:h2map:c1) to a connection object
@roadmap_1195_li
#Option for SCRIPT to only process one or a set of tables, and append to a file
@roadmap_1196_li
#Support using a unique index for IS NULL (including linked tables)
@roadmap_1197_li
#Support linked tables to the current database
@roadmap_1198_li
#Support dynamic linked schema (automatically adding/updating/removing tables)
@roadmap_1199_li
#Compatibility with Derby: VALUES(1), (2); SELECT * FROM (VALUES (1), (2)) AS myTable(c1)
@roadmap_1200_li
#Compatibility: # is the start of a single line comment (MySQL) but date quote (Access). Mode specific
@roadmap_1201_li
#Run benchmarks with JDK 1.5, JDK 1.6, java -server
@roadmap_1202_li
#Optimizations: Faster hash function for strings, byte arrays, big decimal
@roadmap_1203_li
#DatabaseEventListener: callback for all operations (including expected time, RUNSCRIPT) and cancel functionality
@roadmap_1204_li
#H2 Console / large result sets: use 'streaming' instead of building the page in-memory
@roadmap_1205_li
#Benchmark: add a graph to show how databases scale (performance/database size)
@roadmap_1206_li
#Implement a SQLData interface to map your data over to a custom object
@roadmap_1207_li
#Make DDL (Data Definition) operations transactional
@roadmap_1208_li
#Allow execution time prepare for SELECT * FROM CSVREAD(?, 'columnNameString')
@roadmap_1209_li
#Support multiple directories (on different hard drives) for the same database
@roadmap_1210_li
#Server protocol: use challenge response authentication, but client sends hash(user+password) encrypted with response
@roadmap_1211_li
#Support EXEC[UTE] (doesn't return a result set, compatible to MS SQL Server)
@roadmap_1212_li
#Support native XML data type
@roadmap_1213_li
#Support triggers with a string property or option: SpringTrigger, OSGITrigger
@roadmap_1214_li
#Clustering: adding a node should be very fast and without interrupting clients (very short lock)
@roadmap_1215_li
#Support materialized views (using triggers)
@roadmap_1216_li
#Store dates in local time zone (portability of database files)
@roadmap_1217_li
#Ability to resize the cache array when resizing the cache
@roadmap_1218_li
#Time based cache writing (one second after writing the log)
@roadmap_1219_li
#Check state of H2 driver for DDLUtils: https://issues.apache.org/jira/browse/DDLUTILS-185
@roadmap_1220_li
#Index usage for REGEXP LIKE.
@roadmap_1221_li
#Compatibility: add a role DBA (like ADMIN).
@roadmap_1222_li
#Better support multiple processors for in-memory databases.
@roadmap_1223_li
#Access rights: remember the owner of an object. COMMENT: allow owner of object to change it.
@roadmap_1224_li
#Access rights: Finer grained access control (grant access for specific functions)
@roadmap_1225_li
#Support N'text'
@roadmap_1226_li
#Support SCOPE_IDENTITY() to avoid problems when inserting rows in a trigger
@roadmap_1227_li
#Set a connection read only (Connection.setReadOnly)
@roadmap_1228_li
#In MySQL mode, for AUTO_INCREMENT columns, don't set the primary key
@roadmap_1229_li
#Use JDK 1.4 file locking to create the lock file (but not yet by default); writing a system property to detect concurrent access from the same VM (different classloaders).
@roadmap_1230_li
#Support compatibility for jdbc:hsqldb:res:
@roadmap_1231_li
#In the MySQL and PostgreSQL mode, use lower case identifiers by default (DatabaseMetaData.storesLowerCaseIdentifiers = true)
@roadmap_1232_li
#Provide a simple, lightweight O/R mapping tool
@roadmap_1233_li
#Provide an Java SQL builder with standard and H2 syntax
@roadmap_1234_li
#Trace: write OS, file system, JVM,... when opening the database
@roadmap_1235_li
#Support indexes for views (probably requires materialized views)
@roadmap_1236_li
#Document SET SEARCH_PATH, BEGIN, EXECUTE, parameters
@roadmap_1237_li
#Browser: use Desktop.isDesktopSupported and browse when using JDK 1.6
@roadmap_1238_li
#Server: use one listener (detect if the request comes from an PG or TCP client)
@roadmap_1239_li
#Store dates as 'local'. Existing files use GMT. Use escape syntax for compatibility.
@roadmap_1240_li
#Support data type INTERVAL
@roadmap_1241_li
#Optimize SELECT MIN(ID), MAX(ID), COUNT(*) FROM TEST WHERE ID BETWEEN 100 AND 200
@roadmap_1242_li
#Support Oracle functions: TRUNC, NVL2, TO_CHAR, TO_DATE, TO_NUMBER
@roadmap_1243_li
#Sequence: PostgreSQL compatibility (rename, create) (http://www.postgresql.org/docs/8.2/static/sql-altersequence.html)
@roadmap_1244_li
#DISTINCT: Support large result sets by sorting on all columns (additionally) and then removing duplicates.
@roadmap_1245_li
#File system that writes to two file systems (replicating file system)
@roadmap_1246_li
#File system with a background writer thread; test if this is faster
@roadmap_1247_li
#FTP access to a database (.csv for a table, a directory for a schema, a file for a lob, a script.sql file).
@roadmap_1248_li
#LIMIT and OFFSET for GROUP_CONCAT
@roadmap_1249_li
#Support triggers for INFORMATION_SCHEMA tables (to better support PostgreSQL catalog: rebuild after creating new tables)
@roadmap_1250_li
#Better document the source code
@roadmap_1251_li
#Support select * from dual a left join dual b on b.x=(select max(x) from dual)
@roadmap_1252_li
#Optimization: don't lock when the database is read-only
@roadmap_1253_li
#Integrate spatial functions from http://geosysin.iict.ch/irstv-trac/wiki/H2spatial/Download
@roadmap_1254_li
#Support COSH, SINH, and TANH functions
@roadmap_1255_li
#Native search: support "phrase search", wildcard search (* and ?), case-insensitive search, boolean operators, and grouping
@roadmap_1256_li
#Improve documentation of access rights
@roadmap_1257_li
#Support ENUM data type (see MySQL, PostgreSQL, MS SQL Server, maybe others)
@roadmap_1258_li
#Command line option for the H2 Console and TCP configuration (which .h2.server.properties and .h2.keystore to use)
@roadmap_1259_li
#Support a schema name for Java functions
@roadmap_1260_li
#Remember the domain of a column
@roadmap_1261_li
#Support Jackcess (MS Access databases)
@roadmap_1262_li
#Built-in methods to write large objects (BLOB and CLOB): FILE_WRITE('test.txt', 'Hello World')
@roadmap_1263_li
#Change package name in version 2.0: org.h2database
@roadmap_1264_li
#MVCC: support transactionally consistent backups using SCRIPT
@roadmap_1265_li
#Improve time to open large databases (see mail 'init time for distributed setup')
@roadmap_1266_li
#Move Maven 2 repository from hsql.sf.net to h2database.sf.net
@roadmap_1267_li
#Java 1.5 tool: JdbcUtils.closeSilently(s1, s2,...)
@roadmap_1268_li
#Javadoc: document design patterns used
@roadmap_1269_li
#Triggers for metadata tables; use for PostgreSQL catalog
@roadmap_1270_li
#Does the FTP server has problems with multithreading?
@roadmap_1271_li
#Write an article about SQLInjection (h2\src\docsrc\html\images\SQLInjection.txt)
@roadmap_1272_li
#Convert SQL-injection-2.txt to html document, include SQLInjection.java sample
@roadmap_1273_li
#Send SQL Injection solution proposal to MySQL, Derby, HSQLDB,...
@roadmap_1274_li
#Improve LOB in directories performance
@roadmap_1275_li
#Optimize OR conditions: convert them to IN(...) if possible.
@roadmap_1276_li
#Web site design: http://www.igniterealtime.org/projects/openfire/index.jsp
@roadmap_1277_li
#HSQLDB compatibility: Openfire server uses: CREATE SCHEMA PUBLIC AUTHORIZATION DBA; CREATE USER SA PASSWORD ""; GRANT DBA TO SA; SET SCHEMA PUBLIC
@roadmap_1278_li
#Web site: Rename Performance to Comparison [/Compatibility], move Comparison to Other Database Engines to Comparison, move Products that Work with H2 to Comparison, move Performance Tuning to Advanced Topics
@roadmap_1279_li
#Support JMX: Create an MBean for each database and server (support JConsole). See http://thedevcloud.blogspot.com/2008/10/displaying-hsql-database-manager-in.html
@roadmap_1280_li
#Translation: use ?? in help.csv
@roadmap_1281_li
#Translated .pdf
@roadmap_1282_li
#Cluster: hot deploy (adding a node at runtime)
@roadmap_1283_li
#MySQL compatibility: update test1 t1, test2 t2 set t1.id = t2.id where t1.id = t2.id;
@roadmap_1284_li
#Try again with Lobo browser (pure Java)
@roadmap_1285_li
#Recovery tool: bad blocks should be converted to INSERT INTO SYSTEM_ERRORS(...), and things should go into the .trace.db file
@roadmap_1286_li
#RECOVER=2 to backup the database, run recovery, open the database
@roadmap_1287_li
#Recovery should work with encrypted databases
@roadmap_1288_li
#Corruption: new error code, add help
@roadmap_1289_li
#Space reuse: after init, scan all storages and free those that don't belong to a live database object
@roadmap_1290_li
#SysProperties: change everything to H2_...
@roadmap_1291_li
#Use FilterIn / FilterOut putStream?
@roadmap_1292_li
#Access rights: add missing features (users should be 'owner' of objects; missing rights for sequences; dropping objects)
@roadmap_1293_li
#Support NOCACHE table option (Oracle)
@roadmap_1294_li
#Index usage for UPDATE ... WHERE .. IN (SELECT...)
@roadmap_1295_li
#Add regular javadocs (using the default doclet, but another css) to the homepage.
@roadmap_1296_li
#The database should be kept open for a longer time when using the server mode.
@roadmap_1297_li
#Javadocs: for each tool, add a copy & paste sample in the class level.
@roadmap_1298_li
#Javadocs: add @author tags.
@roadmap_1299_li
#Fluent API for tools: Server.createTcpServer().setPort(9081).setPassword(password).start();
@roadmap_1300_li
#MySQL compatibility: real SQL statement for DESCRIBE TEST
@roadmap_1301_li
#Use a default delay of 1 second before closing a database.
@roadmap_1302_li
#Maven: upload source code and javadocs as well.
@roadmap_1303_li
#Write (log) to system table before adding to internal data structures.
@roadmap_1304_li
#Support very large deletes and updates.
@roadmap_1305_li
#Doclet (javadocs): constructors are not listed.
@roadmap_1306_li
#Support direct lookup for MIN and MAX when using WHERE (see todo.txt / Direct Lookup).
@roadmap_1307_li
#Support other array types (String[], double[]) in PreparedStatement.setObject(int, Object);
@roadmap_1308_li
#MVCC should not be memory bound (uncommitted data is kept in memory in the delta index; maybe using a regular btree index solves the problem).
@roadmap_1309_li
#Support CREATE TEMPORARY LINKED TABLE.
@roadmap_1310_li
#MySQL compatibility: SELECT @variable := x FROM SYSTEM_RANGE(1, 50);
@roadmap_1311_li
#Oracle compatibility: support NLS_DATE_FORMAT.
@roadmap_1312_li
#Support flashback queries as in Oracle.
@roadmap_1313_li
#Import / Export of fixed with text files.
@roadmap_1314_li
#Support for OUT parameters in user-defined procedures.
@roadmap_1315_li
#Support getGeneratedKeys to return multiple rows when used with batch updates. This is supported by MySQL, but not Derby. Both PostgreSQL and HSQLDB don't support getGeneratedKeys. Also support it when using INSERT ... SELECT.
@roadmap_1316_li
#HSQLDB compatibility: automatic data type for SUM if value is the value is too big (by default use the same type as the data).
@roadmap_1317_li
#Improve the optimizer to select the right index for special cases: where id between 2 and 4 and booleanColumn
@roadmap_1318_li
#Enable warning for 'Local variable declaration hides another field or variable'.
@roadmap_1319_li
#Linked tables: make hidden columns available (Oracle: rowid and ora_rowscn columns).
@roadmap_1320_li
#Support merge join.
@roadmap_1321_li
#H2 Console: in-place autocomplete.
@roadmap_1322_li
#Oracle: support DECODE method (convert to CASE WHEN).
@roadmap_1323_li
#Support large databases: split LOB (BLOB, CLOB) to multiple directories / disks (similar to tablespaces).
@roadmap_1324_li
#Support to assign a primary key index a user defined name.
@roadmap_1325_li
#Cluster: Add feature to make sure cluster nodes can not get out of sync (for example by stopping one process).
@roadmap_1326_li
#H2 Console: support configuration option for fixed width (monospace) font.
@roadmap_1327_li
#Native fulltext search: support analyzers (specially for Chinese, Japanese).
@roadmap_1328_li
#Automatically compact databases from time to time (as a background process).
@roadmap_1329_li
#Support SCOPE_IDENTITY().
@roadmap_1330_li
#Support GRANT SELECT, UPDATE ON *.
@roadmap_1331_li
#Test Eclipse DTP.
@roadmap_1332_li
#H2 Console: autocomplete: keep the previous setting
@roadmap_1333_li
#MySQL, MS SQL Server compatibility: support case sensitive (mixed case) identifiers without quotes.
@roadmap_1334_li
#executeBatch: option to stop at the first failed statement.
@roadmap_1335_li
#Implement OLAP features as described here: http://www.devx.com/getHelpOn/10MinuteSolution/16573/0/page/5
@roadmap_1336_li
#Support Oracle ROWID (unique identifier for each row).
@roadmap_1337_li
#Server mode: Improve performance for batch updates.
@roadmap_1338_li
#Applets: Support read-only databases in a zip file (accessed as a resource).
@roadmap_1339_li
#Long running queries / errors / trace system table.
@roadmap_1340_li
#H2 Console should support JaQu directly.
@roadmap_1341_li
#Option to copy the old version of each changed page once after a checkpoint.
@roadmap_1342_li
#H2 Console: support single file upload and directory download (optional).
@roadmap_1343_li
#Document FTL_SEARCH, FTL_SEARCH_DATA.
@roadmap_1344_li
#Support DatabaseMetaData.insertsAreDetected: updatable result sets should detect inserts.
@roadmap_1345_li
#Auto-server: add option to define the IP address range or list.
@roadmap_1346_li
#Open a read-only database but don't share it with other connections. jdbc:h2:~/test;PRIVATE=TRUE
@roadmap_1347_li
#Index creation only using deterministic functions.
@roadmap_1348_li
#Use http://recaptcha.net somehow to secure the Google Group.
@roadmap_1349_li
#Support DELETE with TOP or LIMIT. See also: http://dev.mysql.com/doc/refman/5.1/de/delete.html
@roadmap_1350_li
#Change the default for NULL || 'x' to return NULL
@roadmap_1351_li
#ANALYZE: Use a bloom filter for each indexed column to estimate count of distinct values.
@roadmap_1352_li
#ANALYZE: For unique indexes that allow null, count the number of null.
@roadmap_1353_li
#AUTO_SERVER: support changing IP addresses (disable a network while the database is open).
@roadmap_1354_li
#Avoid using java.util.Calendar internally because it's slow, complicated, and seems to be buggy.
@roadmap_1355_li
#Support TRUNCATE .. CASCADE like PostgreSQL.
@roadmap_1356_li
#Support opening a database that is in the classpath, maybe using a new file system.
@roadmap_1357_li
#Fulltext search: lazy result generation using SimpleRowSource.
@roadmap_1358_li
#Support transformation to join for user defined functions, as for IN(SELECT...).
@roadmap_1359_li
#Fulltext search: Support alternative syntax: WHERE FTL_CONTAINS(name, 'hello').
@roadmap_1360_li
#MySQL compatibility: support REPLACE, see http://dev.mysql.com/doc/refman/5.1/de/replace.html
@roadmap_1361_li
#MySQL compatibility: support INSERT INTO table SET column1 = value1, column2 = value2
@roadmap_1362_li
#Docs: Add a one line description for each functions and SQL statements at the top (in the link section).
@roadmap_1363_li
#Javadoc search: weight for titles should be higher ('random' should list Functions as the best match).
@roadmap_1364_li
#Replace information_schema tables with regular tables that are automatically re-built when needed. Use indexes.
@roadmap_1365_li
#Support a special trigger on all tables.
@roadmap_1366_li
#Delete temporary files or objects using finalize.
@roadmap_1367_li
#Oracle compatibility: support calling 0-parameters functions without parenthesis. Make constants obsolete.
@roadmap_1368_li
#MySQL, HSQLDB compatibility: support where 'a'=1 (not supported by Derby, PostgreSQL)
@roadmap_1369_li
#CSV: currently # is a line comment and can start at any field. Make it optional.
@roadmap_1370_li
#Add database creation date and time to the database.
@roadmap_1371_li
#Support ASSERTIONS.
@roadmap_1372_li
#MySQL compatibility: support comparing 1='a'
@roadmap_1373_li
#Support PostgreSQL lock modes: http://www.postgresql.org/docs/8.3/static/explicit-locking.html
@roadmap_1374_li
#PostgreSQL compatibility: test DbVisualizer and Squirrel SQL using a new PostgreSQL JDBC driver.
@roadmap_1375_li
#RunScript should be able to read from system in (or quite mode for Shell).
@roadmap_1376_li
#Natural join: support select x from dual natural join dual.
@roadmap_1377_li
#Optimize IN(...) for DELETE and UPDATE.
@roadmap_1378_li
#Natural join: somehow support this: select a.x, b.x, x from dual a natural join dual b
@roadmap_1379_li
#MySQL compatibility: for auto_increment columns, convert 0 to next value (as when inserting NULL).
@roadmap_1380_li
#Functions: support hashcode(value)
@roadmap_1381_li
#Sequences: CURRVAL should be session specific. Compatibility with PostgreSQL.
@roadmap_1382_li
#Serialized file lock: support long running queries.
@roadmap_1383_h2
#Not Planned
@roadmap_1384_li
#HSQLDB (did) support this: select id i from test where i>0 (other databases don't). Supporting it may break compatibility.
@roadmap_1385_li
#String.intern (so that Strings can be compared with ==) will not be used because some VMs have problems when used extensively.
@search_1000_b
検索:
@search_1001_td
Highlight keyword(s)
@search_1002_a
ホーム
@search_1003_a
クイックスタート
@search_1004_a
インストール
@search_1005_a
チュートリアル
@search_1006_a
特徴
@search_1007_a
パフォーマンス
@search_1008_a
進歩したトピックス
@search_1009_a
#JaQu
@search_1010_a
ダウンロード
@search_1011_b
参照
@search_1012_a
SQL文法
@search_1013_a
関数
@search_1014_a
データ型
@search_1015_a
Javadoc
@search_1016_a
PDFドキュメント
@search_1017_a
#Error Analyzer
@search_1018_b
付録
@search_1019_a
ビルド
@search_1020_a
歴史とロードマップ
@search_1021_a
#Links
@search_1022_a
FAQ
@search_1023_a
ライセンス
@sourceError_1000_h1
#Online Error Analyzer
@sourceError_1001_a
ホーム
@sourceError_1002_a
#Input
@sourceError_1003_h2
# Details Source Code
@sourceError_1004_p
#Fill in the error message and stack trace and click on 'Details' or 'Source Code':
@sourceError_1005_b
#Error Code:
@sourceError_1006_b
#Product Version:
@sourceError_1007_b
メッセージ:
@sourceError_1008_b
#More Information:
@sourceError_1009_b
#Stack Trace:
@sourceError_1010_b
#Source File:
@sourceError_1011_p
#Raw file
@sourceError_1012_p
#(fast; only Firefox)
@tutorial_1000_h1
チュートリアル
@tutorial_1001_a
起動とH2コンソールの使用
@tutorial_1002_a
#Settings of the H2 Console
@tutorial_1003_a
JDBCを使用してデータベースに接続
@tutorial_1004_a
新しいデータベースを作成する
@tutorial_1005_a
サーバーを使用する
@tutorial_1006_a
Hibernateを使用する
@tutorial_1007_a
#Using TopLink and Glassfish
@tutorial_1008_a
Webアプリケーションで データベースを使用する
@tutorial_1009_a
CSV (Comma Separated Values) サポート
@tutorial_1010_a
アップグレード、 バックアップ、修復
@tutorial_1011_a
#Command Line Tools
@tutorial_1012_a
OpenOffice Baseを使用する
@tutorial_1013_a
Java Web Start / JNLP
@tutorial_1014_a
#Using a Connection Pool
@tutorial_1015_a
フルテキストサーチ
@tutorial_1016_a
#User-Defined Variables
@tutorial_1017_a
#Date and Time
@tutorial_1018_a
#Using Spring
@tutorial_1019_h2
起動とH2コンソールの使用
@tutorial_1020_p
#The H2 Console application lets you access a SQL database using a browser interface. This can be a H2 database, or another database that supports the JDBC API.
@tutorial_1021_p
これはクライアント / サーバーアプリケーションで、サーバーとクライアントの両方実行されることが必要です。
@tutorial_1022_p
プラットフォームと環境によって、アプリケーションの起動方法が多数あります:
@tutorial_1023_th
OS
@tutorial_1024_th
起動
@tutorial_1025_td
Windows
@tutorial_1026_td
[スタート]、 [すべてのプログラム]、 [H2]、 [H2 Console]をクリックします
@tutorial_1027_td
正しく動作したら、 システムトレイにアイコンが追加されます:
@tutorial_1028_td
システムトレイアイコンが表示されなかったら、 Javaが正しくインストールされていないのかもしれません。 (この場合は、 他のアプリケーション起動方法を試して下さい) ブラウザウィンドウが開き、ログインページが表示されます。 (URL: http://localhost:8082/)
@tutorial_1029_td
Windows
@tutorial_1030_td
ファイルブラウザを開き、h2/binフォルダまで進み、h2.batをダブルクリックします。
@tutorial_1031_td
正しく動作したら、システムトレイにアイコンが追加されます。 問題があれば、コンソールウィンドウにエラーメッセージが表示されます。 ブラウザウィンドウが開き、ログインページが表示されます。 (URL: http://localhost:8082/)
@tutorial_1032_td
Any
@tutorial_1033_td
コンソールウィンドウを開き、'h2/lib'ディレクトリまで進み、下記を実行します:
@tutorial_1034_h3
ファイアウォール
@tutorial_1035_p
サーバーを起動させたら、ファイアウォールによるセキュリティ警告を受けるでしょう (1度インストールした場合)。外部ネットワークからあなたのマシンのデータベースにアクセスされたくないのであれば、ファイアーウォールが他の接続を遮断します。ローカルマシンからの接続はまだつながっています。他のコンピュータから、このコンピューターのデータベースにアクセスしたい場合のみ、 ファイアウォールでリモート接続を許可する必要があります。
@tutorial_1036_p
#It has been reported that when using Kaspersky 7.0 with firewall, the H2 Console is very slow when connecting over the IP address. A workaround is to connect using localhost, however this only works on the local machine.
@tutorial_1037_p
小さなファイアーウォールはすでにサーバーに組み込まれています。 デフォルトによるこの構造は、他のコンピューターがサーバーにアクセスすることを許可していません。 これは、好きなように変更することができます (他のコンピューターからの接続を許可します)。
@tutorial_1038_h3
ネイティブ バージョン
@tutorial_1039_p
ネイティブ バージョンはJavaを必要としていません。なぜなら、これはGCJを使用してコンパイルされるからです。しかし、H2は現在、Windows上のGCJプロジェクトでは実行されません。異なったプラットフォームでソフトウェアをコンパイルすることが可能です。
@tutorial_1040_h3
Javaをテストする
@tutorial_1041_p
インストールしたJavaのバージョンを調べるためには、 コマンドプロンプトを開き、 下記を入力します:
@tutorial_1042_p
もしエラーメッセージが表示されたら、Javaのバイナリディレクトリを環境変数のPathに追加します。
@tutorial_1043_h3
エラーメッセージ 'Port is in use'
@tutorial_1044_p
ひとつのH2コンソールのみ起動することができます。 そうでなければ、次のようなエラーメッセージが表示されます:
Port is in use, maybe another ... server already running on...
複数のコンソールアプリケーションを同じコンピューターで起動することは可能です (異なったポートを使用します)、しかし、コンソールが複数の同時接続を維持するということは、普通は必要とされていません。
@tutorial_1045_h3
他のポートを使用する
@tutorial_1046_p
もしポートが他のアプリケーションによって使用されている場合は、H2コンソールを異なったポートで起動したいはずです。これは、.h2.server.properties.ファイル内のポートを変更することにより実行できます。このファイルはユーザディレクトリ内に格納されています (Windowsでは通常、"Documents and Settings/<ユーザ名>")。関連する項目はwebPortです。
@tutorial_1047_h3
起動成功
@tutorial_1048_p
コンソールウィンドウからのサーバー起動が成功したら、新しいウィンドウが開き、 下記のように表示されます:
@tutorial_1049_p
ウィンドウ内をクリックしないで下さい; アプリケーションが遮断されてしまいます (Fast-Edit モードが有効の場合)。
@tutorial_1050_h3
ブラウザを使用してサーバーに接続
@tutorial_1051_p
#If the server started successfully, you can connect to it using a web browser. The browser needs to support JavaScript, frames and cascading stylesheets (css). If you started the server on the same computer as the browser, go to http://localhost:8082 in the browser. If you want to connect to the application from another computer, you need to provide the IP address of the server, for example: http://192.168.0.2:8082 . If you enabled SSL on the server side, the URL needs to start with HTTPS.
@tutorial_1052_h3
複数の同時セッション
@tutorial_1053_p
複数の同時ブラウザセッションがサポートされています。 データベースオブジェクトはサーバーに属しているため、同時接続の数はサーバーアプリケーションの利用可能メモリによって制限されています。
@tutorial_1054_h3
ログイン
@tutorial_1055_p
ログインページでは、データベースに接続するための接続情報を設定する必要があります。 JDBCドライバをデータベースのクラスに設定し、JDBCのURL、ユーザ名とパスワードを入力します。 完了したら [Connect] をクリックします。
@tutorial_1056_p
保存された設定をあらかじめ保存し、再び使用することができます。設定はアプリケーションプロパティファイルに記憶されます。
@tutorial_1057_h3
エラーメッセージ
@tutorial_1058_p
エラーメッセージは赤で表示されます。 メッセージをクリックすることによって、例外の記録の表示、非表示を切り替えることができます。
@tutorial_1059_h3
データベースドライバの追加
@tutorial_1060_p
H2DRIVERSかCLASSPATHの環境変数に、ドライバのJarファイルの位置を追加することにより、データベースドライバの追加を行うことができます。 例 (Windowsの場合): データベースドライバのライブラリに C:\Programs\hsqldb\lib\hsqldb.jar を追加し、H2DRIVERSの環境変数に C:\Programs\hsqldb\lib\hsqldb.jar を設定します。
@tutorial_1061_p
複数のドライバを設定することも可能です; それぞれのパスは ';' (Windows) や ':' (他のOS) で区切ります。 パス名内のスペースは有効です。設定は引用されません。
@tutorial_1062_h3
アプリケーションを使用する
@tutorial_1063_p
アプリケーションは3つのメインパネルを保持しています。上部のツールバー、左側のツリーとクエリ、右側の結果表示パネルです。データベースオブジェクト (例; テーブル) は左側のパネルに一覧表示されます。クエリパネルにSQLコマンドを打ち、 'Run' をクリックします。 コマンドの結果は、コマンドのすぐ下に表示されます。
@tutorial_1064_h3
テーブル名、またはカラム名をインサートする
@tutorial_1065_p
テーブル名やカラム名は、ツリー内のテーブル名、カラム名をクリックすることによってスクリプトにインサートすることができます。クエリが空の時にテーブルをクリックすると、 'SELECT * FROM ...' も同様に追加されます。 クエリを入力している間、使用されているテーブルはツリー内で自動的に拡張されます。例えば、 'SELECT * FROM TEST T WHERE T.' と入力すると、ツリー内のTESTテーブルは自動的に拡張されます。
@tutorial_1066_h3
切断とアプリケーションの終了
@tutorial_1067_p
ブラウザでは、ツールバーパネルの 'Disconnect' をクリックします。データベースからログアウトします。しかし、サーバーはまだ接続されていて、 新しいセッションを受け入れる準備をしています。
@tutorial_1068_p
サーバーを止めるためには、システムトレイアイコンを右クリックし、 [Exit] を選択します。もしアイコンが表示されていないのであれば、 (別の方法で実行した場合) サーバーが実行されたコンソール上で [Ctrl]+[C] を押すか (Windowsの場合)、コンソールウィンドウを閉じます。
@tutorial_1069_h2
#Settings of the H2 Console
@tutorial_1070_p
#The settings of the H2 Console are stored in a configuration file called .h2.server.properties
in you user home directory. For Windows installations, the user home directory is usually C:\Documents and Settings\[username]
. The configuration file contains the settings of the application and is automatically created when the H2 Console is first started.
@tutorial_1071_h2
JDBCを使用してデータベースに接続
@tutorial_1072_p
#To connect to a database, a Java application first needs to load the database driver, and then get a connection. A simple way to do that is using the following code:
@tutorial_1073_p
このコードは最初にドライバをロードして (Class.forName())、 接続を開始します (DriverManager.getConnection())。 このドライバの名前は全てのケースにおいて "org.h2.Driver" です。 データベースに認識されるため、データベースのURLは常に jdbc:h2: から始まります。 getConnection() 内の2番目のパラメーターはユーザ名を指しています ('sa' はこの場合、システム管理者を表しています)。3番目のパラメーターはパスワードです。このデータベースでは、ユーザ名は大文字と小文字を区別していませんが、パスワードは大文字と小文字を区別しています。
@tutorial_1074_h2
新しいデータベースを作成する
@tutorial_1075_p
初期設定では、データベースの指定されたURLがまだ存在しない場合、自動的に新しい (空の) データベースが作られます。
@tutorial_1076_h2
サーバーを使用する
@tutorial_1077_p
H2は現在、3つのサーバーをサポートしています: Webサーバー、TCPサーバー、ODBCサーバーです。 これらのサーバーは異なった方法で起動します。
@tutorial_1078_h3
コマンドラインから起動する
@tutorial_1079_p
初期設定でコマンドラインからサーバーを起動させるには、次のように実行します。
@tutorial_1080_p
サーバーはデフォルトオプションで起動します。オプションの一覧を取得するには、次のように実行します。
@tutorial_1081_p
異なったポートの使用が可能なオプションや、サーバーの一部を起動、終了させるオプションなどがあります。 詳細はサーバーツールのAPIドキュメントをご覧下さい。
@tutorial_1082_h3
TCPサーバーに接続する
@tutorial_1083_p
データベースへリモート接続するためには、TCPサーバーを使用します。次のドライバとデータベースURLを利用します:
@tutorial_1084_li
JDBCドライバクラス: org.h2.Driver
@tutorial_1085_li
データベースURL: jdbc:h2:tcp://localhost/~/test
@tutorial_1086_p
データベースURLについての詳細は、特徴内のページをご覧下さい。
@tutorial_1087_h3
アプリケーション内で起動する
@tutorial_1088_p
アプリケーション内からサーバーを起動、終了することも可能です。 以下はサンプルコードです:
@tutorial_1089_h3
他の過程からTCPサーバーを終了する
@tutorial_1090_p
TCPサーバーは他の過程から終了することができます。 コマンドラインからサーバーを終了するには、次のように実行します:
@tutorial_1091_p
ユーザアプリケーションからサーバーを終了するには、次のコードを使用します:
@tutorial_1092_p
この機能はサーバー上の System.exit を呼んでいます。この機能は、データベースが次回起動された時のリカバリーを回避するため、データベースへの全ての接続が切断された後に呼ばれます。リモートサーバーを終了するには、サーバー上でリモート接続が可能である必要があります。
@tutorial_1093_h2
Hibernateを使用する
@tutorial_1094_p
#This database supports Hibernate version 3.1 and newer. You can use the HSQLDB Dialect, or the native H2 Dialect. Unfortunately the H2 Dialect included in Hibernate is buggy. A patch for Hibernate has been submitted. The dialect for the newest version of Hibernate is also available at src/tools/org/hibernate/dialect/H2Dialect.java.txt. You can rename it to H2Dialect.java and include this as a patch in your application.
@tutorial_1095_h2
#Using TopLink and Glassfish
@tutorial_1096_p
#To use H2 with Glassfish (or Sun AS), set the Datasource Classname to org.h2.jdbcx.JdbcDataSource
. You can set this in the GUI at Application Server - Resources - JDBC - Connection Pools, or by editing the file sun-resources.xml
: at element jdbc-connection-pool
, set the attribute datasource-classname
to org.h2.jdbcx.JdbcDataSource
.
@tutorial_1097_p
#The H2 database is compatible with HSQLDB and PostgreSQL. To take advantage of H2 specific features, use the H2Platform
. The source code of this platform is included in H2 at src/tools/oracle/toplink/essentials/platform/database/DatabasePlatform.java.txt
. You will need to copy this file to your application, and rename it to .java. To enable it, change the following setting in persistence.xml:
@tutorial_1098_p
#In old versions of Glassfish, the property name is toplink.platform.class.name
.
@tutorial_1099_h2
Webアプリケーションで データベースを使用する
@tutorial_1100_p
Webアプリケーション内からデータベースに接続するには様々な方法があります。 以下はTomcatかJBossを使用の場合のいくつかの例です。
@tutorial_1101_h3
エンベッドモード
@tutorial_1102_p
(現在)最も簡単なソリューションはエンベッドモードでデータベースを使用することです。 それは、アプリケーションが起動する時や (良いソリューションは Servletリスナーを使用します。下記参照)、セッションが起動する時、アプリケーションにおける接続が開始するということを意味します。データベースは、セッションやアプリケーションが同じ過程で実行している限り、多様なセッションやアプリケーションから同時に接続されることが可能です。 多くのServletコンテナは (例; Tomcat) ただひとつのプロセスで利用されるので、問題はありません。 (Tomcatをクラスターモードで起動している場合を除いて)。 Tomcatはマルチスレッドとマルチクラスローダーを使用しています。もし複数のアプリケーションが同じデータベースに同時にアクセスする場合、データベースjarをshared/lib、またはserver/libディレクトリに置く必要があります。 webアプリケーションが起動した時にデータベースを開き、webアプリケーションが終了した時にデータベースを閉じるのが良い方法です。もし複数のアプリケーションを使用する場合、そのうちひとつのアプリケーションをこのように動作することが必要です。アプリケーションでは、セッションごとにひとつの接続を使うか、リクエスト(アクション)ごとにひとつの接続を使うという概念があります。これらの接続はできる限り、使用後に終了させます(しかし、終了させなくても悪くはありません)。
@tutorial_1103_h3
サーバーモード
@tutorial_1104_p
サーバーモードは類似していますが、他のプロセスでサーバーを起動させることを許可しています。
@tutorial_1105_h3
データベースの起動と終了にServletリスナーを使用する
@tutorial_1106_p
#Add the h2*.jar file your web application, and add the following snippet to your web.xml file (after context-param and before filter):
@tutorial_1107_p
#For details on how to access the database, see the file DbStarter.java. By default the DbStarter listener opens an embedded connection using the database URL jdbc:h2:~/test and user name and password 'sa'. If you want to use it within your servlet, you can access it like this:
@tutorial_1108_p
#The DbStarter can also start the TCP server, however this is disabled by default. To enable it, use the parameter db.tcpServer in the file web.xml. Here is the complete list of options. These options are set just after the display-name and description tag, but before any listener and filter tags:
@tutorial_1109_p
#When the web application is stopped, the database connection will be closed automatically. If the server is started within the DbStarter, it will also be stopped automatically when the web application is stopped.
@tutorial_1110_h3
#Using the H2 Console Servlet
@tutorial_1111_p
#The H2 Console is a standalone application and includes its own web server, but it can be used as a servlet as well. To do that, include the the h2 jar file in your application, and add the following configuration to your web.xml:
@tutorial_1112_p
#For details, see also src/tools/WEB-INF/web.xml
.
@tutorial_1113_p
#To create a web application that creates just the H2 Console, run the following command:
@tutorial_1114_h2
CSV (Comma Separated Values) サポート
@tutorial_1115_p
データベースにCSVREADとCSVWRITEの関数を使用することで、 CSVファイルサポートを使用することができ、スタンドアロンツールとしてデータベースの外でCSVライブラリを使用することができます。
@tutorial_1116_h3
データベース内からCSVファイルに書き込む
@tutorial_1117_p
クエリからCSVファイルを作成するのに、組込み関数 CSVWRITEを使用することができます。例:
@tutorial_1118_h3
データベース内からCSVファイルを読み込む
@tutorial_1119_p
CSVREAD関数を使用してCSVファイルを読み込むことができます。 例:
@tutorial_1120_h3
JavaアプリケーションからCSVファイルに書き込む
@tutorial_1121_p
データベースを全く使用しなくても、JavaアプリケーションでCSVツールを使用することができます。 例:
@tutorial_1122_h3
JavaアプリケーションからCSVファイルを読み込む
@tutorial_1123_p
データベースを開かなくてもCSVファイルを読み込むことができます。 例:
@tutorial_1124_h2
アップグレード、 バックアップ、修復
@tutorial_1125_h3
データベースのアップグレー
@tutorial_1126_p
あるバージョンのデータベースエンジンを次のバージョンにアップグレードする際の推奨する方法は、 古いエンジンを使って(SQLスクリプトのフォームでの)データベースのバックアップを作成し、新しいエンジンを使ってSQLスクリプトを実行します。
@tutorial_1127_h3
バックアップ
@tutorial_1128_p
異なった方法のデータベースのバックアップがあります。例えば、データベースファイルをコピーすることが可能です。しかしながら、この方法はデータベースが使用されている間は推奨しません。データベースは人が判読しやすく、極めて大きいというわけではありません。データベースバックアップの推奨する方法は、圧縮したSQLスクリプトを作成することです。この方法は、バックアップツールを使用することで可能です:
@tutorial_1129_p
オプションについての情報は、SQLコマンドスクリプトをご覧下さい。バックアップは遠隔で行えますが、ファイルはサーバー側に作られます。サーバーからファイルを取るのに、ビルトインFTPサーバーを使用することができます。データベースのバックアップを作るのに、SQLコマンドスクリプトを 使用することもできます。
@tutorial_1130_h3
修復
@tutorial_1131_p
SQLスクリプトファイルからデータベースを修復するには、RunScriptツールを使用する必要があります:
@tutorial_1132_p
オプションについての情報は、SQLコマンド RUNSCRIPTをご覧下さい。修復は遠隔で行えますが、サーバー側にファイルが存在する必要があります。サーバーからファイルをコピーするのに、ビルトインFTPサーバーを使用することができます。SQLスクリプトを実行するために、 SQLコマンド RUNSCRIPTを使用することができます。SQLスクリプトファイルには、RUNSCRIPTコマンドのフォーム内に他のスクリプトファイルのリファレンスが含まれています。しかしながら、サーバーモードを使用している時、リファレンススクリプトファイルはサーバー側で利用可能であることが必要です。
@tutorial_1133_h3
オンラインバックアップ
@tutorial_1134_p
BACKUP SQLステートメントとバックアップツールの両方が全てのデータベースファイルをzipファイル形式で作成します。しかし、このファイルのコンテンツは人間が解読可能なものではありません。SCRIPTステートメントを除いて、BACKUPステートメントはデータベースオブジェクトをロックしないため、他のユーザーをブロックしません。結果として、バックアップは一貫性のあるトランザクションです:
@tutorial_1135_p
バックアップツール (org.h2.tools.Backup) はオンラインバックアップを作成するために利用されません; このプログラムが実行されている間、データベースは使用されてはいけません。
@tutorial_1136_h2
#Command Line Tools
@tutorial_1137_p
#This database comes with a number of command line tools. To get more information about a tool, start it with the parameter '-?', for example:
@tutorial_1138_p
#The command line tools are:
@tutorial_1139_b
バックアップ
@tutorial_1140_li
#creates a backup of a database.
@tutorial_1141_b
#ChangeFileEncryption
@tutorial_1142_li
#allows changing the file encryption password or algorithm of a database.
@tutorial_1143_b
#Console
@tutorial_1144_li
#starts the browser based H2 Console.
@tutorial_1145_b
#ConvertTraceFile
@tutorial_1146_li
#converts a .trace.db file to a Java application and SQL script.
@tutorial_1147_b
#CreateCluster
@tutorial_1148_li
#creates a cluster from a standalone database.
@tutorial_1149_b
#DeleteDbFiles
@tutorial_1150_li
#deletes all files belonging to a database.
@tutorial_1151_b
#Script
@tutorial_1152_li
#allows converting a database to a SQL script for backup or migration.
@tutorial_1153_b
#Recover
@tutorial_1154_li
#helps recovering a corrupted database.
@tutorial_1155_b
#Restore
@tutorial_1156_li
#restores a backup of a database.
@tutorial_1157_b
#RunScript
@tutorial_1158_li
#runs a SQL script against a database.
@tutorial_1159_b
Server
@tutorial_1160_li
#is used in the server mode to start a H2 server.
@tutorial_1161_b
#Shell
@tutorial_1162_li
#is a command line database tool.
@tutorial_1163_p
#The tools can also be called from an application by calling the main or another public methods. For details, see the Javadoc documentation.
@tutorial_1164_h2
OpenOffice Baseを使用する
@tutorial_1165_p
OpenOffice.org Base はJDBC API上のデータベースアクセスをサポートしています。 OpenOffice Baseを使ってH2データベースに接続するためには、最初にOpenOfficeにJDBCドライバを追加する必要があります。H2データベースに接続する手順:
@tutorial_1166_li
#Start OpenOffice Writer, go to [Tools], [Options]
@tutorial_1167_li
#Make sure you have selected a Java runtime environment in OpenOffice.org / Java
@tutorial_1168_li
#Click [Class Path...], [Add Archive...]
@tutorial_1169_li
#Select your h2 jar file (location is up to you, could be wherever you choose)
@tutorial_1170_li
#Click [OK] (as much as needed), stop OpenOffice (including the Quickstarter)
@tutorial_1171_li
OpenOffice Base を起動する
@tutorial_1172_li
存在するデータベースに接続し、JDBCを選択し、[Next] をクリックする
@tutorial_1173_li
#Example datasource URL: jdbc:h2:~/test
@tutorial_1174_li
JDBCドライバクラス: org.h2.Driver
@tutorial_1175_p
#Now you can access the database stored in the current users home directory.
@tutorial_1176_p
#To use H2 in NeoOffice (OpenOffice without X11):
@tutorial_1177_li
#In NeoOffice, go to [NeoOffice], [Preferences]
@tutorial_1178_li
#Look for the page under [NeoOffice], [Java]
@tutorial_1179_li
#Click [Classpath], [Add Archive...]
@tutorial_1180_li
#Select your h2 jar file (location is up to you, could be wherever you choose)
@tutorial_1181_li
#Click [OK] (as much as needed), restart NeoOffice.
@tutorial_1182_p
#Now, when creating a new database using the "Database Wizard":
@tutorial_1183_li
#Select "connect to existing database" and the type "jdbc". Click next.
@tutorial_1184_li
#Enter your h2 database URL. The normal behavior of H2 is that a new db is created if it doesn't exist.
@tutorial_1185_li
#Next step - up to you... you can just click finish and start working.
@tutorial_1186_p
#Another solution to use H2 in NeoOffice is:
@tutorial_1187_li
#Package the h2 jar within an extension package
@tutorial_1188_li
#Install it as a Java extension in NeoOffice
@tutorial_1189_p
#This can be done by create it using the NetBeans OpenOffice plugin. See also Extensions Development .
@tutorial_1190_h2
Java Web Start / JNLP
@tutorial_1191_p
Java Web Start / JNLP (Java Network Launch Protocol) を使用している時、パーミッションタグは.jnlp ファイルに設定され、application.jarファイルは署名されていなければなりません。そうでなければ、ファイルシステムに書き込もうとした時、次の例外が発生するでしょう: java.security.AccessControlException: access denied (java.io.FilePermission ... read) パーミッションタグの例:
@tutorial_1192_h2
#Using a Connection Pool
@tutorial_1193_p
#For many databases, opening a connection is slow, and it is a good idea to use a connection pool to re-use connections. For H2 however opening a connection usually is fast if the database is already open. Using a connection pool for H2 actually slows down the process a bit, except if file encryption is used (in this case opening a connection is about half as fast as using a connection pool). A simple connection pool is included in H2. It is based on the Mini Connection Pool Manager from Christian d'Heureuse. There are other, more complex connection pools available, for example DBCP . The build-in connection pool is used as follows:
@tutorial_1194_h2
フルテキストサーチ
@tutorial_1195_p
H2はLuceneフルテキストサーチとnativeフルテキストサーチの実装をサポートしています。
@tutorial_1196_h3
Nativeフルテキストサーチを使用する
@tutorial_1197_p
初期化するには、次を呼び出します:
@tutorial_1198_p
#You need to initialize it in each database where you want to use it. Afterwards, you can create a full text index for a table using:
@tutorial_1199_p
PUBLICはスキーマ、TESTはテーブル名です。カラム名のリスト (分離されたカラム) はオプションです。このケースでは、全てのカラムがインデックスです。インデックスはリードタイムに更新されます。インデックスを検索するには、次のクエリーを使用します:
@tutorial_1200_p
#This will produce a result set that contains the query needed to retrieve the data:
@tutorial_1201_p
#QUERY: "PUBLIC"."TEST" WHERE "ID"=1
@tutorial_1202_p
#To get the raw data, use FT_SEARCH_DATA('Hello', 0, 0);
. The result contains the columns SCHEMA (the schema name), TABLE (the table name), COLUMNS (an array of column names), and KEYS (an array of objects). To join a table, use a join as in: SELECT T.*FROM FT_SEARCH_DATA('Hello', 0, 0) FT, TEST T WHERE FT.TABLE='TEST' AND T.ID= FT.KEYS[0];
@tutorial_1203_p
Javaアプリケーション内からインデックスを呼び出すことも可能です:
@tutorial_1204_h3
Luceneフルテキストサーチを使用する
@tutorial_1205_p
#To use the Lucene full text search, you need the Lucene library in the classpath. How his is done depends on the application; if you use the H2 Console, you can add the Lucene jar file to the environment variables H2DRIVERS or CLASSPATH. To initialize the Lucene full text search in a database, call:
@tutorial_1206_p
#You need to initialize it in each database where you want to use it. Afterwards, you can create a full text index for a table using:
@tutorial_1207_p
PUBLICはスキーマ、TESTはテーブル名です。カラム名のリスト (分離されたカラム) はオプションです。このケースでは、全てのカラムがインデックスです。インデックスはリードタイムに更新されます。インデックスを検索するには、次のクエリーを使用します:
@tutorial_1208_p
#This will produce a result set that contains the query needed to retrieve the data:
@tutorial_1209_p
#QUERY: "PUBLIC"."TEST" WHERE "ID"=1
@tutorial_1210_p
#To get the raw data, use FT_SEARCH_DATA('Hello', 0, 0);
. The result contains the columns SCHEMA (the schema name), TABLE (the table name), COLUMNS (an array of column names), and KEYS (an array of objects). To join a table, use a join as in: SELECT T.*FROM FT_SEARCH_DATA('Hello', 0, 0) FT, TEST T WHERE FT.TABLE='TEST' AND T.ID= FT.KEYS[0];
@tutorial_1211_p
Javaアプリケーション内からインデックスを呼び出すことも可能です:
@tutorial_1212_h2
#User-Defined Variables
@tutorial_1213_p
#This database supports user-defined variables. Variables start with @ and can be used wherever expressions or parameters are used. Variables not persisted and session scoped, that means only visible for the session where they are defined. A value is usually assigned using the SET command:
@tutorial_1214_p
#It is also possible to change a value using the SET() method. This is useful in queries:
@tutorial_1215_p
#Variables that are not set evaluate to NULL. The data type of a user-defined variable is the data type of the value assigned to it, that means it is not necessary (or possible) to declare variable names before using them. There are no restrictions on the assigned values; large objects (LOBs) are supported as well.
@tutorial_1216_h2
#Date and Time
@tutorial_1217_p
#Date, time and timestamp values support ISO 8601 formatting, including time zone:
@tutorial_1218_p
#If the time zone is not set, the value is parsed using the current time zone setting of the system. Date and time information is stored in H2 database files in GMT (Greenwich Mean Time). If the database is opened using another system time zone, the date and time will change accordingly. If you want to move a database from one time zone to the other and don't want this to happen, you need to create a SQL script file using the SCRIPT command or Script tool, and then load the database using the RUNSCRIPT command or the RunScript tool in the new time zone.
@tutorial_1219_h2
#Using Spring
@tutorial_1220_p
#Use the following configuration to start and stop the H2 TCP Server using the Spring Framework:
@tutorial_1221_p
#The "destroy-method" will help prevent exceptions on hot-redeployment or when restarting server.