提交 d3f18cfa authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 0451349f
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
</java> </java>
</target> </target>
<target name="compileResources" depends="clean"> <target name="compileResources" depends="clean, compileTest">
<javac target="${jdk}" source="${jdk}" executable="${javac}" srcdir="src/main" destdir="bin" debug="true" includes="org/h2/util/Resources.java"/> <javac target="${jdk}" source="${jdk}" executable="${javac}" srcdir="src/main" destdir="bin" debug="true" includes="org/h2/util/Resources.java"/>
<java fork="true" classname="org.h2.util.Resources" classpath="bin" dir="."/> <java fork="true" classname="org.h2.util.Resources" classpath="bin" dir="."/>
<delete> <delete>
...@@ -89,19 +89,19 @@ ...@@ -89,19 +89,19 @@
</delete> </delete>
</target> </target>
<target name="compileServlet" depends="compileServletTest, compile" if="servlet.jar.present"> <target name="compileServlet" depends="compile" if="servlet.jar.present">
<javac target="${jdk}" source="${jdk}" executable="${javac}" srcdir="src/tools" destdir="bin" debug="true"> <javac target="${jdk}" source="${jdk}" executable="${javac}" srcdir="src/tools" destdir="bin" debug="true">
<classpath location="${path.servlet.jar}" /> <classpath location="${path.servlet.jar}" />
<include name="org/h2/server/web/*.*"/> <include name="org/h2/server/web/*.*"/>
</javac> </javac>
</target> </target>
<target name="compileServletTest" depends="init" unless="servlet.jar.present"> <target name="compileServletTest" depends="init" unless="java.version.ok">
<echo message="Servlet API jar not found, console servlet not compiled."/> <echo message="Servlet API jar not found, console servlet not compiled."/>
<echo message="Please set ant-build.properties / path.servlet.jar"/> <echo message="Please set ant-build.properties / path.servlet.jar"/>
</target> </target>
<target name="compile" depends="compileResources"> <target name="compile" depends="compileResources, compileTest">
<javac target="${jdk}" source="${jdk}" executable="${javac}" srcdir="src/main" destdir="bin" debug="true"/> <javac target="${jdk}" source="${jdk}" executable="${javac}" srcdir="src/main" destdir="bin" debug="true"/>
<javac target="${jdk}" source="${jdk}" executable="${javac}" srcdir="src/test" destdir="bin" debug="true"/> <javac target="${jdk}" source="${jdk}" executable="${javac}" srcdir="src/test" destdir="bin" debug="true"/>
<javac target="${jdk}" source="${jdk}" executable="${javac}" srcdir="src/tools" destdir="bin" debug="true"> <javac target="${jdk}" source="${jdk}" executable="${javac}" srcdir="src/tools" destdir="bin" debug="true">
...@@ -117,6 +117,11 @@ ...@@ -117,6 +117,11 @@
</copy> </copy>
</target> </target>
<target name="compileTest" unless="java.version.ok">
<echo message="Java version is ${java.specification.version} but source code is switched to ${jdk}."/>
<echo message="Run ant codeswitchJdk.. first."/>
</target>
<target name="createPatch" depends="clean"> <target name="createPatch" depends="clean">
<delete file="../h2-patch.*"/> <delete file="../h2-patch.*"/>
<tar destfile="../h2-patch.tar" basedir="." includes="src/**/*.java,build.xml"/> <tar destfile="../h2-patch.tar" basedir="." includes="src/**/*.java,build.xml"/>
...@@ -146,6 +151,23 @@ ...@@ -146,6 +151,23 @@
<target name="init"> <target name="init">
<available file="${path.servlet.jar}" property="servlet.jar.present"/> <available file="${path.servlet.jar}" property="servlet.jar.present"/>
<condition property="java.version.ok">
<or>
<and>
<equals arg1="${java.specification.version}" arg2="1.6"/>
<equals arg1="${jdk}" arg2="1.6"/>
</and>
<and>
<equals arg1="${java.specification.version}" arg2="1.5"/>
<equals arg1="${jdk}" arg2="1.4"/>
</and>
<and>
<equals arg1="${java.specification.version}" arg2="1.4"/>
<equals arg1="${jdk}" arg2="1.4"/>
</and>
</or>
</condition>
<echo message="${java.version.ok} spec:${java.specification.version} jdk:${jdk}"></echo>
</target> </target>
<target name="jar" depends="compile, compileServlet"> <target name="jar" depends="compile, compileServlet">
......
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- <!--
Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html). Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
...@@ -107,16 +106,16 @@ This may not have the desired effect if a default value in the target table is o ...@@ -107,16 +106,16 @@ This may not have the desired effect if a default value in the target table is o
This database supports the following transaction isolation levels: This database supports the following transaction isolation levels:
</p> </p>
<ul> <ul>
<li><b>Serializable</b><br /> <li><b>Read Committed</b><br />
This is the default level.<br /> This is the default level.
To enable, execute the SQL statement 'SET LOCK_MODE 0'<br />
or append ;LOCK_MODE=1 to the database URL: jdbc:h2:~/test;LOCK_MODE=1
</li><li><b>Read Committed</b><br />
Read locks are released immediately. Read locks are released immediately.
Higher concurrency is possible when using this level.<br /> Higher concurrency is possible when using this level.<br />
This is the isolation level used for many database systems.<br /> To enable, execute the SQL statement 'SET LOCK_MODE 3'<br />
To enable, execute the SQL statement 'SET LOCK_MODE 0'<br />
or append ;LOCK_MODE=3 to the database URL: jdbc:h2:~/test;LOCK_MODE=3 or append ;LOCK_MODE=3 to the database URL: jdbc:h2:~/test;LOCK_MODE=3
</li><li>
<b>Serializable</b><br />
To enable, execute the SQL statement 'SET LOCK_MODE 1'<br />
or append ;LOCK_MODE=1 to the database URL: jdbc:h2:~/test;LOCK_MODE=1
</li><li><b>Read Uncommitted</b><br /> </li><li><b>Read Uncommitted</b><br />
This level means that transaction isolation is disabled.<br /> This level means that transaction isolation is disabled.<br />
To enable, execute the SQL statement 'SET LOCK_MODE 0'<br /> To enable, execute the SQL statement 'SET LOCK_MODE 0'<br />
...@@ -452,8 +451,7 @@ Referential integrity rules are always enforced. ...@@ -452,8 +451,7 @@ Referential integrity rules are always enforced.
<h3>Isolation</h3> <h3>Isolation</h3>
<p> <p>
For H2, the default isolation level is 'serializable', which means complete isolation. For H2, as with most other database systems, the default isolation level is 'read committed'.
The default transaction isolation level for many other databases is 'read committed'.
This provides better performance, but also means that transactions are not completely isolated. This provides better performance, but also means that transactions are not completely isolated.
H2 supports the transaction isolation levels 'serializable', 'read committed', and 'read uncommitted'. H2 supports the transaction isolation levels 'serializable', 'read committed', and 'read uncommitted'.
</p> </p>
......
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- <!--
Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html). Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
...@@ -13,7 +12,6 @@ Build ...@@ -13,7 +12,6 @@ Build
<table class="content"><tr class="content"><td class="content"><div class="contentDiv"> <table class="content"><tr class="content"><td class="content"><div class="contentDiv">
<h1>Build</h1> <h1>Build</h1>
<a href="#portability"> <a href="#portability">
Portability</a><br /> Portability</a><br />
<a href="#environment"> <a href="#environment">
...@@ -25,13 +23,17 @@ Build ...@@ -25,13 +23,17 @@ Build
<br /><a name="portability"></a> <br /><a name="portability"></a>
<h2>Portability</h2> <h2>Portability</h2>
<p>
This database is written in Java and therefore works on many platforms. This database is written in Java and therefore works on many platforms.
It can also be compiled to a native executable using GCJ. It can also be compiled to a native executable using GCJ.
</p>
<br /><a name="environment"></a> <br /><a name="environment"></a>
<h2>Environment</h2> <h2>Environment</h2>
<p>
To build the database executables, the following software stack was used. To build the database executables, the following software stack was used.
In most cases, newer version or compatible software works too. In most cases, newer version or compatible software works too.
</p>
<ul> <ul>
<li>Windows XP <li>Windows XP
</li><li>Sun JDK Version 1.4 or 1.5 </li><li>Sun JDK Version 1.4 or 1.5
...@@ -43,6 +45,7 @@ In most cases, newer version or compatible software works too. ...@@ -43,6 +45,7 @@ In most cases, newer version or compatible software works too.
<br /><a name="building"></a> <br /><a name="building"></a>
<h2>Building the Software</h2> <h2>Building the Software</h2>
<p>
On the command line, go to the directory src and execute the following command: On the command line, go to the directory src and execute the following command:
<pre> <pre>
ant -projecthelp ant -projecthelp
...@@ -57,10 +60,12 @@ use the target jarClient: ...@@ -57,10 +60,12 @@ use the target jarClient:
ant jarClient ant jarClient
</pre> </pre>
The other targets may be used as well. The other targets may be used as well.
</p>
<br /><a name="maven2"></a> <br /><a name="maven2"></a>
<h2>Using Maven 2</h2> <h2>Using Maven 2</h2>
<h3>Using a Central Repository</h3> <h3>Using a Central Repository</h3>
<p>
You can include the database in your Maven 2 project as a dependency. You can include the database in your Maven 2 project as a dependency.
The version is currently 1.0.&lt;year&gt;&lt;month&gt;&lt;day&gt;. Example: The version is currently 1.0.&lt;year&gt;&lt;month&gt;&lt;day&gt;. Example:
<pre> <pre>
...@@ -70,8 +75,10 @@ The version is currently 1.0.&lt;year&gt;&lt;month&gt;&lt;day&gt;. Example: ...@@ -70,8 +75,10 @@ The version is currently 1.0.&lt;year&gt;&lt;month&gt;&lt;day&gt;. Example:
&lt;version&gt;1.0.20070617&lt;/version&gt; &lt;version&gt;1.0.20070617&lt;/version&gt;
&lt;/dependency&gt; &lt;/dependency&gt;
</pre> </pre>
</p>
<h3>Using Snapshot Version</h3> <h3>Using Snapshot Version</h3>
<p>
To build a 'snapshot' H2 .jar file and upload it the to the local Maven 2 repository, execute the following command: To build a 'snapshot' H2 .jar file and upload it the to the local Maven 2 repository, execute the following command:
<pre> <pre>
ant mavenUploadLocal ant mavenUploadLocal
...@@ -84,5 +91,6 @@ Afterwards, you can include the database in your Maven 2 project as a dependency ...@@ -84,5 +91,6 @@ Afterwards, you can include the database in your Maven 2 project as a dependency
&lt;version&gt;1.0-SNAPSHOT&lt;/version&gt; &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
&lt;/dependency&gt; &lt;/dependency&gt;
</pre> </pre>
</p>
</div></td></tr></table></body></html> </div></td></tr></table></body></html>
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- <!--
Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html). Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
......
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- <!--
Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html). Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
......
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- <!--
Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html). Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
...@@ -85,7 +84,7 @@ Features ...@@ -85,7 +84,7 @@ Features
<h3>Additional Features</h3> <h3>Additional Features</h3>
<ul> <ul>
<li>Disk based or in-memory databases and tables, read-only database support, temporary tables <li>Disk based or in-memory databases and tables, read-only database support, temporary tables
</li><li>Transaction support (serializable transaction isolation), 2-phase-commit </li><li>Transaction support (read committed and serializable transaction isolation), 2-phase-commit
</li><li>Multiple connections, table level locking </li><li>Multiple connections, table level locking
</li><li>Cost based optimizer, using a genetic algorithm for complex queries, zero-administration </li><li>Cost based optimizer, using a genetic algorithm for complex queries, zero-administration
</li><li>Scrollable and updatable result set support, large result set, external result sorting, functions can return a result set </li><li>Scrollable and updatable result set support, large result set, external result sorting, functions can return a result set
......
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- <!--
Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html). Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
...@@ -24,6 +23,7 @@ History ...@@ -24,6 +23,7 @@ History
<br /><a name="history"></a> <br /><a name="history"></a>
<h2>History of this Database Engine</h2> <h2>History of this Database Engine</h2>
<p>
The development of H2 was started in May 2004, The development of H2 was started in May 2004,
but it was first published on December 14th 2005. but it was first published on December 14th 2005.
The author of H2, Thomas Mueller, is also the original developer of Hypersonic SQL. The author of H2, Thomas Mueller, is also the original developer of Hypersonic SQL.
...@@ -32,6 +32,7 @@ At that point, he had to discontinue Hypersonic SQL, but then the HSQLDB Group w ...@@ -32,6 +32,7 @@ At that point, he had to discontinue Hypersonic SQL, but then the HSQLDB Group w
to continued to work on the Hypersonic SQL codebase. to continued to work on the Hypersonic SQL codebase.
The name H2 stands for Hypersonic 2; however H2 does not share any code with The name H2 stands for Hypersonic 2; however H2 does not share any code with
Hypersonic SQL or HSQLDB. H2 is built from scratch. Hypersonic SQL or HSQLDB. H2 is built from scratch.
</p>
<br /><a name="changelog"></a> <br /><a name="changelog"></a>
<h2>Change Log</h2> <h2>Change Log</h2>
...@@ -39,7 +40,11 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch. ...@@ -39,7 +40,11 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
<h3>Version 1.0 (Current)</h3> <h3>Version 1.0 (Current)</h3>
<h3>Version 1.0 / TODO (Build xx)</h3><ul> <h3>Version 1.0 / TODO (Build xx)</h3><ul>
<li>PG server: data was truncated when reading large VARCHAR columns and decimal columns. <li>Google translate did not work for the H2 homepage. It should be fixed now.
</li><li>The CONVERT function did not work with views when using UNION.
</li><li>The build now issues a warning if the source code is switched to the wrong version.
</li><li>The default lock mode is now read committed instead of serialized.
</li><li>PG server: data was truncated when reading large VARCHAR columns and decimal columns.
</li><li>PG server: when the same database was accessed multiple times using the PostgreSQL ODBC driver, </li><li>PG server: when the same database was accessed multiple times using the PostgreSQL ODBC driver,
the pg_catalog schema update failed, and connecting to the database was not possible. Fixed. the pg_catalog schema update failed, and connecting to the database was not possible. Fixed.
</li><li>Some file operations didn't work for files in the root directory. Fixed. </li><li>Some file operations didn't work for files in the root directory. Fixed.
...@@ -810,7 +815,6 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch. ...@@ -810,7 +815,6 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
</li><li>Special methods for DataPage.writeByte / writeShort and so on </li><li>Special methods for DataPage.writeByte / writeShort and so on
</li><li>Index organized tables CREATE TABLE...(...) ORGANIZATION INDEX (store in data file) (probably file format changes are required for rowId) </li><li>Index organized tables CREATE TABLE...(...) ORGANIZATION INDEX (store in data file) (probably file format changes are required for rowId)
</li><li>Change the default for NULL || 'x' to NULL </li><li>Change the default for NULL || 'x' to NULL
</li><li>Change the default isolation level to read committed
</li><li>Automatic upgrade if there is a file format change </li><li>Automatic upgrade if there is a file format change
</li></ul> </li></ul>
...@@ -1108,6 +1112,8 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch. ...@@ -1108,6 +1112,8 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
</li><li>Access rights: remember the owner of an object. COMMENT: allow owner of object to change it. </li><li>Access rights: remember the owner of an object. COMMENT: allow owner of object to change it.
</li><li>Implement INSTEAD OF trigger. </li><li>Implement INSTEAD OF trigger.
</li><li>Access rights: Finer grained access control (grant access for specific functions) </li><li>Access rights: Finer grained access control (grant access for specific functions)
</li><li>Support N'text'
</li><li>Support SCOPE_IDENTITY() to avoid problems when inserting rows in a trigger
</li></ul> </li></ul>
<h3>Not Planned</h3> <h3>Not Planned</h3>
...@@ -1118,9 +1124,11 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch. ...@@ -1118,9 +1124,11 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
<br /><a name="supporters"></a> <br /><a name="supporters"></a>
<h2>Supporters</h2> <h2>Supporters</h2>
<p>
Many thanks for those who helped by finding and reporting bugs, gave valuable feedback, 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 spread the word and have translated this project. Also many thanks to the donors who contributed
via PayPal: via PayPal:
</p>
<ul> <ul>
<li>Florent Ramiere, France <li>Florent Ramiere, France
</li><li>Pete Haidinyak, USA </li><li>Pete Haidinyak, USA
......
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- <!--
Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html). Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
...@@ -25,7 +24,9 @@ Installation ...@@ -25,7 +24,9 @@ Installation
<br /><a name="requirements"></a> <br /><a name="requirements"></a>
<h2>Requirements</h2> <h2>Requirements</h2>
<p>
To run the database, the following minimum software stack is known to work: To run the database, the following minimum software stack is known to work:
</p>
<ul> <ul>
<li>Windows XP, MacOS, or Linux <li>Windows XP, MacOS, or Linux
</li><li>Recommended Windows file system: NTFS (FAT32 supports files up to 4 GB) </li><li>Recommended Windows file system: NTFS (FAT32 supports files up to 4 GB)
...@@ -35,15 +36,19 @@ To run the database, the following minimum software stack is known to work: ...@@ -35,15 +36,19 @@ To run the database, the following minimum software stack is known to work:
<br /><a name="supported_platforms"></a> <br /><a name="supported_platforms"></a>
<h2>Supported Platforms</h2> <h2>Supported Platforms</h2>
<p>
As this database is written in Java, it can be run on many different platforms. As this database is written in Java, it can be 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. 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 The source code does not use features of Java 1.5. Currently, the database is
developed and tested on Windows XP using the Sun JDK 1.4, but it also developed and tested on Windows XP using the Sun JDK 1.4, but it also
works in many other operating systems and using other Java runtime environments. works in many other operating systems and using other Java runtime environments.
</p>
<br /><a name="installing"></a> <br /><a name="installing"></a>
<h2>Installing the Software</h2> <h2>Installing the Software</h2>
<p>
To install the software, run the installer or unzip it to a directory of your choice. To install the software, run the installer or unzip it to a directory of your choice.
</p>
<br /><a name="directory_structure"></a> <br /><a name="directory_structure"></a>
<h2>Directory Structure</h2> <h2>Directory Structure</h2>
......
...@@ -24,7 +24,9 @@ Installation ...@@ -24,7 +24,9 @@ Installation
<br /><a name="requirements"></a> <br /><a name="requirements"></a>
<h2>必要条件</h2> <h2>必要条件</h2>
<p>
データベースを実行するために、以下のソフトウェアが動作することを確認します。 互換性のあるソフトウェアでも動作しますが、テストはされていません。 データベースを実行するために、以下のソフトウェアが動作することを確認します。 互換性のあるソフトウェアでも動作しますが、テストはされていません。
</p>
<ul> <ul>
<li>Windows XP, MacOS, or Linux <li>Windows XP, MacOS, or Linux
</li><li>Recommended Windows file system: NTFS (FAT32 supports files up to 4 GB) </li><li>Recommended Windows file system: NTFS (FAT32 supports files up to 4 GB)
...@@ -34,11 +36,15 @@ Installation ...@@ -34,11 +36,15 @@ Installation
<br /><a name="supported_platforms"></a> <br /><a name="supported_platforms"></a>
<h2>サポートされているプラットフォーム</h2> <h2>サポートされているプラットフォーム</h2>
<p>
このデータベースはJavaで書かれているため、多くの異なったプラットフォームで実行することができます。 Java 1.4 と 1.5でテストされましたが、GCJを使用することでネイティブコードにコンパイルすることもできます。 ソースコードはJava 1.5の特徴は使われていません。現在、データベースはWindows XPでSun JDKを使用して開発、テストされていますが、 おそらく、他の多くのOSと他のJava Runtime Environmentを使用しても動作するでしょう。 このデータベースはJavaで書かれているため、多くの異なったプラットフォームで実行することができます。 Java 1.4 と 1.5でテストされましたが、GCJを使用することでネイティブコードにコンパイルすることもできます。 ソースコードはJava 1.5の特徴は使われていません。現在、データベースはWindows XPでSun JDKを使用して開発、テストされていますが、 おそらく、他の多くのOSと他のJava Runtime Environmentを使用しても動作するでしょう。
</p>
<br /><a name="installing"></a> <br /><a name="installing"></a>
<h2>ソフトウェアのインストール</h2> <h2>ソフトウェアのインストール</h2>
<p>
ソフトウェアをインストールするために、インストーラーを実行するか 選択したディレクトリにソフトウェアを解凍します。 ソフトウェアをインストールするために、インストーラーを実行するか 選択したディレクトリにソフトウェアを解凍します。
</p>
<br /><a name="directory_structure"></a> <br /><a name="directory_structure"></a>
<h2>ディレクトリ構成</h2> <h2>ディレクトリ構成</h2>
......
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- <!--
Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html). Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
Initial Developer: H2 Group Initial Developer: H2 Group
--> -->
<html><head><meta http-equiv="Content-Type" content="text/html;charset=utf-8" /><title> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head><meta http-equiv="Content-Type" content="text/html;charset=utf-8" /><title>
License License
</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /> </title><link rel="stylesheet" type="text/css" href="stylesheet.css" />
<script type="text/javascript" src="navigation.js"></script> <script type="text/javascript" src="navigation.js"></script>
...@@ -13,9 +14,11 @@ License ...@@ -13,9 +14,11 @@ License
<h1>License</h1> <h1>License</h1>
<h2>Summary and License FAQ</h2> <h2>Summary and License FAQ</h2>
<p>
This license is a modified version of the MPL 1.1 available at <a href="http://www.mozilla.org/MPL">www.mozilla.org/MPL</a>, This license is a modified version of the MPL 1.1 available at <a href="http://www.mozilla.org/MPL">www.mozilla.org/MPL</a>,
the changes are <u>underlined</u>. the changes are <em class="u">underlined</em>.
There is a License FAQ section at the Mozilla web site, most of that is applicable to the H2 License as well. There is a License FAQ section at the Mozilla web site, most of that is applicable to the H2 License as well.
</p>
<ul> <ul>
<li>You can use H2 for free. You can integrate it into your application (including commercial applications), <li>You can use H2 for free. You can integrate it into your application (including commercial applications),
and you can distribute it. and you can distribute it.
...@@ -79,12 +82,12 @@ copyright and license as the original code. The copyright of the ported source c ...@@ -79,12 +82,12 @@ copyright and license as the original code. The copyright of the ported source c
Original Code or any previous Modifications. When Covered Code is released as a Original Code or any previous Modifications. When Covered Code is released as a
series of files, a Modification is: series of files, a Modification is:
</p> </p>
<ol type="a"> <p id="section-1.9-a">1.9.a. Any addition to or deletion from the contents of a file
<li id="section-1.9-a">Any addition to or deletion from the contents of a file
containing Original Code or previous Modifications. containing Original Code or previous Modifications.
</li><li id="section-1.9-b">Any new file that contains any part of the Original Code or </p>
<p id="section-1.9-b">1.9.b. Any new file that contains any part of the Original Code or
previous Modifications. previous Modifications.
</li></ol> </p>
<p id="section-1.10"><b>1.10. "Original Code"</b> <p id="section-1.10"><b>1.10. "Original Code"</b>
means Source Code of computer software code which is described in the Source Code means Source Code of computer software code which is described in the Source Code
notice required by <a href="#exhibit-a">Exhibit A</a> as Original Code, and which, notice required by <a href="#exhibit-a">Exhibit A</a> as Original Code, and which,
...@@ -118,56 +121,65 @@ copyright and license as the original code. The copyright of the ported source c ...@@ -118,56 +121,65 @@ copyright and license as the original code. The copyright of the ported source c
<h3 id="section-2">2. Source Code License</h3> <h3 id="section-2">2. Source Code License</h3>
<h4 id="section-2.1">2.1. The Initial Developer Grant</h4> <h4 id="section-2.1">2.1. The Initial Developer Grant</h4>
<p>
The Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive The Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive
license, subject to third party intellectual property claims: license, subject to third party intellectual property claims:
<ol type="a"> </p>
<li id="section-2.1-a">under intellectual property rights (other than patent or <p id="section-2.1-a">2.1.a. under intellectual property rights (other than patent or
trademark) Licensable by Initial Developer to use, reproduce, modify, display, perform, trademark) Licensable by Initial Developer to use, reproduce, modify, display, perform,
sublicense and distribute the Original Code (or portions thereof) with or without sublicense and distribute the Original Code (or portions thereof) with or without
Modifications, and/or as part of a Larger Work; and Modifications, and/or as part of a Larger Work; and
</li><li id="section-2.1-b">under Patents Claims infringed by the making, using or selling </p>
<p id="section-2.1-b">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 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). otherwise dispose of the Original Code (or portions thereof).
</li><li id="section-2.1-c">the licenses granted in this Section 2.1 </p>
<p id="section-2.1-c">2.1.c. the licenses granted in this Section 2.1
(<a href="#section-2.1-a">a</a>) and (<a href="#section-2.1-b">b</a>) are effective on (<a href="#section-2.1-a">a</a>) and (<a href="#section-2.1-b">b</a>) are effective on
the date Initial Developer first distributes Original Code under the terms of this the date Initial Developer first distributes Original Code under the terms of this
License. License.
</li><li id="section-2.1-d">Notwithstanding Section 2.1 (<a href="#section-2.1-b">b</a>) </p>
<p id="section-2.1-d">2.1.d. Notwithstanding Section 2.1 (<a href="#section-2.1-b">b</a>)
above, no patent license is granted: 1) for code that You delete from the Original Code; 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 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 modification of the Original Code or ii) the combination of the Original Code with other
software or devices. software or devices.
</li></ol> </p>
<h4 id="section-2.2">2.2. Contributor Grant</h4> <h4 id="section-2.2">2.2. Contributor Grant</h4>
<p>
Subject to third party intellectual property claims, each Contributor hereby grants You Subject to third party intellectual property claims, each Contributor hereby grants You
a world-wide, royalty-free, non-exclusive license a world-wide, royalty-free, non-exclusive license
<ol type="a"> </p>
<li id="section-2.2-a">under intellectual property rights (other than patent or trademark) <p id="section-2.2-a">2.2.a. under intellectual property rights (other than patent or trademark)
Licensable by Contributor, to use, reproduce, modify, display, perform, sublicense and Licensable by Contributor, to use, reproduce, modify, display, perform, sublicense and
distribute the Modifications created by such Contributor (or portions thereof) either on 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 an unmodified basis, with other Modifications, as Covered Code and/or as part of a Larger
Work; and Work; and
</li><li id="section-2.2-b">under Patent Claims infringed by the making, using, or selling of </p>
<p id="section-2.2-b">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 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 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 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 (or portions thereof); and 2) the combination of Modifications made by that Contributor
with its Contributor Version (or portions of such combination). with its Contributor Version (or portions of such combination).
</li><li id="section-2.2-c">the licenses granted in Sections 2.2 </p>
<p id="section-2.2-c">2.2.c. the licenses granted in Sections 2.2
(<a href="#section-2.2-a">a</a>) and 2.2 (<a href="#section-2.2-b">b</a>) are effective (<a href="#section-2.2-a">a</a>) and 2.2 (<a href="#section-2.2-b">b</a>) are effective
on the date Contributor first makes Commercial Use of the Covered Code. on the date Contributor first makes Commercial Use of the Covered Code.
</li><li id="section-2.2-d">Notwithstanding Section 2.2 (<a href="#section-2.2-b">b</a>) </p>
<p id="section-2.2-d">2.2.c. Notwithstanding Section 2.2 (<a href="#section-2.2-b">b</a>)
above, no patent license is granted: 1) for any code that Contributor has deleted from 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 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 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 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 Contributor Version) or other devices; or 4) under Patent Claims infringed by Covered Code
in the absence of Modifications made by that Contributor. in the absence of Modifications made by that Contributor.
</li></ol> </p>
<h3 id="section-3">3. Distribution Obligations</h3> <h3 id="section-3">3. Distribution Obligations</h3>
<h4 id="section-3.1">3.1. Application of License</h4> <h4 id="section-3.1">3.1. Application of License</h4>
<p>
The Modifications which You create or to which You contribute are governed by the terms The Modifications which You create or to which You contribute are governed by the terms
of this License, including without limitation Section <a href="#section-2.2">2.2</a>. The of this License, including without limitation Section <a href="#section-2.2">2.2</a>. The
Source Code version of Covered Code may be distributed only under the terms of this License Source Code version of Covered Code may be distributed only under the terms of this License
...@@ -177,7 +189,10 @@ copyright and license as the original code. The copyright of the ported source c ...@@ -177,7 +189,10 @@ copyright and license as the original code. The copyright of the ported source c
restricts the applicable version of this License or the recipients' rights hereunder. 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 However, You may include an additional document offering the additional rights described in
Section <a href="#section-3.5">3.5</a>. Section <a href="#section-3.5">3.5</a>.
</p>
<h4 id="section-3.2">3.2. Availability of Source Code</h4> <h4 id="section-3.2">3.2. Availability of Source Code</h4>
<p>
Any Modification which You create or to which You contribute must be made available in 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 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 version or via an accepted Electronic Distribution Mechanism to anyone to whom you made an
...@@ -187,17 +202,20 @@ copyright and license as the original code. The copyright of the ported source c ...@@ -187,17 +202,20 @@ copyright and license as the original code. The copyright of the ported source c
Modification has been made available to such recipients. You are responsible for ensuring 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 that the Source Code version remains available even if the Electronic Distribution
Mechanism is maintained by a third party. Mechanism is maintained by a third party.
<h4 id="section-3.3">3.3. Description of Modifications</h4> </p>
<h4 id="section-3.3">3.3. Description of Modifications</h4>
<p>
You must cause all Covered Code to which You contribute to contain a file documenting the 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 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 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 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 (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. in which You describe the origin or ownership of the Covered Code.
</p>
<h4 id="section-3.4">3.4. Intellectual Property Matters</h4> <h4 id="section-3.4">3.4. Intellectual Property Matters</h4>
<ol type="a"> <p id="section-3.4-a"><b>3.4.a. Third Party Claims:</b>
<li id="section-3.4-a"><b>Third Party Claims:</b>
If Contributor has knowledge that a license under a third party's intellectual property 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 rights is required to exercise the rights granted by such Contributor under Sections
<a href="#section-2.1">2.1</a> or <a href="#section-2.2">2.2</a>, Contributor must include a <a href="#section-2.1">2.1</a> or <a href="#section-2.2">2.2</a>, Contributor must include a
...@@ -208,17 +226,21 @@ copyright and license as the original code. The copyright of the ported source c ...@@ -208,17 +226,21 @@ copyright and license as the original code. The copyright of the ported source c
all copies Contributor makes available thereafter and shall take other steps (such as 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 notifying appropriate mailing lists or newsgroups) reasonably calculated to inform those who
received the Covered Code that new knowledge has been obtained. received the Covered Code that new knowledge has been obtained.
</li><li id="section-3.4-b"><b>Contributor APIs:</b> </p>
<p id="section-3.4-b"><b>3.4.b. Contributor APIs:</b>
If Contributor's Modifications include an application programming interface and Contributor If Contributor's Modifications include an application programming interface and Contributor
has knowledge of patent licenses which are reasonably necessary to implement that has knowledge of patent licenses which are reasonably necessary to implement that
API, Contributor must also include this information in the legal file. API, Contributor must also include this information in the legal file.
</li><li id="section-3.4-c"><b>Representations:</b> </p>
<p id="section-3.4-c"><b>3.4.c. Representations:</b>
Contributor represents that, except as disclosed pursuant to Section 3.4 Contributor represents that, except as disclosed pursuant to Section 3.4
(<a href="#section-3.4-a">a</a>) above, Contributor believes that Contributor's Modifications (<a href="#section-3.4-a">a</a>) above, Contributor believes that Contributor's Modifications
are Contributor's original creation(s) and/or Contributor has sufficient rights to grant the are Contributor's original creation(s) and/or Contributor has sufficient rights to grant the
rights conveyed by this License. rights conveyed by this License.
</li></ol> </p>
<h4 id="section-3.5">3.5. Required Notices</h4> <h4 id="section-3.5">3.5. Required Notices</h4>
<p>
You must duplicate the notice in <a href="#exhibit-a">Exhibit A</a> in each file of the You must duplicate the notice in <a href="#exhibit-a">Exhibit A</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 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) its structure, then You must include such notice in a location (such as a relevant directory)
...@@ -233,7 +255,10 @@ copyright and license as the original code. The copyright of the ported source c ...@@ -233,7 +255,10 @@ copyright and license as the original code. The copyright of the ported source c
obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer 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 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. as a result of warranty, support, indemnity or liability terms You offer.
</p>
<h4 id="section-3.6">3.6. Distribution of Executable Versions</h4> <h4 id="section-3.6">3.6. Distribution of Executable Versions</h4>
<p>
You may distribute Covered Code in Executable form only if the requirements of Sections You may distribute Covered Code in Executable form only if the requirements of Sections
<a href="#section-3.1">3.1</a>, <a href="#section-3.2">3.2</a>, <a href="#section-3.1">3.1</a>, <a href="#section-3.2">3.2</a>,
<a href="#section-3.3">3.3</a>, <a href="#section-3.4">3.4</a> and <a href="#section-3.3">3.3</a>, <a href="#section-3.4">3.4</a> and
...@@ -252,46 +277,66 @@ copyright and license as the original code. The copyright of the ported source c ...@@ -252,46 +277,66 @@ copyright and license as the original code. The copyright of the ported source c
Initial Developer or any Contributor. You hereby agree to indemnify the Initial Developer and 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 every Contributor for any liability incurred by the Initial Developer or such Contributor as
a result of any such terms You offer. a result of any such terms You offer.
<h4 id="section-3.7">3.7. Larger Works</h4> </p>
<h4 id="section-3.7">3.7. Larger Works</h4>
<p>
You may create a Larger Work by combining Covered Code with other code not governed by the 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, 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. You must make sure the requirements of this License are fulfilled for the Covered Code.
</p>
<h3 id="section-4">4. Inability to Comply Due to Statute or Regulation.</h3> <h3 id="section-4">4. Inability to Comply Due to Statute or Regulation.</h3>
<p>
If it is impossible for You to comply with any of the terms of this License with respect to 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: 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 (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 the limitations and the code they affect. Such description must be included in the
<strong class="very-strong">legal</strong> file described in Section <b>legal</b> file described in Section
<a href="#section-3.4">3.4</a> and must be included with all distributions of the Source Code. <a href="#section-3.4">3.4</a> and must be included with all distributions of the Source Code.
Except to the extent prohibited by statute or regulation, such description must be 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. sufficiently detailed for a recipient of ordinary skill to be able to understand it.
</p>
<h3 id="section-5">5. Application of this License.</h3> <h3 id="section-5">5. Application of this License.</h3>
<p>
This License applies to code to which the Initial Developer has attached the notice in This License applies to code to which the Initial Developer has attached the notice in
<a href="#exhibit-a">Exhibit A</a> and to related Covered Code. <a href="#exhibit-a">Exhibit A</a> and to related Covered Code.
</p>
<h3 id="section-6">6. Versions of the License.</h3> <h3 id="section-6">6. Versions of the License.</h3>
<h4 id="section-6.1">6.1. New Versions</h4> <h4 id="section-6.1">6.1. New Versions</h4>
The <u>H2 Group</u> may publish revised and/or new versions <p>
The <em class="u">H2 Group</em> may publish revised and/or new versions
of the License from time to time. Each version will be given a distinguishing version number. of the License from time to time. Each version will be given a distinguishing version number.
</p>
<h4 id="section-6.2">6.2. Effect of New Versions</h4> <h4 id="section-6.2">6.2. Effect of New Versions</h4>
<p>
Once Covered Code has been published under a particular version of the License, You may 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 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 <u>H2 Group</u>. Covered Code under the terms of any subsequent version of the License published by the <em class="u">H2 Group</em>.
No one other than the <u>H2 Group</u> has the right to modify the terms applicable to Covered Code No one other than the <em class="u">H2 Group</em> has the right to modify the terms applicable to Covered Code
created under this License. created under this License.
</p>
<h4 id="section-6.3">6.3. Derivative Works</h4> <h4 id="section-6.3">6.3. Derivative Works</h4>
<p>
If You create or use a modified version of this License (which you may only do in order to 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) apply it to code which is not already Covered Code governed by this License), You must (a)
rename Your license so that the phrases <u>"H2 Group", "H2"</u> rename Your license so that the phrases <em class="u">"H2 Group", "H2"</em>
or any confusingly similar phrase do not appear in your license (except to note that 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 your license differs from this License) and (b) otherwise make it clear that Your version of
the license contains terms which differ from the <u>H2 License</u>. the license contains terms which differ from the <em class="u">H2 License</em>.
(Filling in the name of the Initial Developer, Original Code or Contributor in the (Filling in the name of the Initial Developer, Original Code or Contributor in the
notice described in <a href="#exhibit-a">Exhibit A</a> shall not of themselves be deemed to notice described in <a href="#exhibit-a">Exhibit A</a> shall not of themselves be deemed to
be modifications of this License.) be modifications of this License.)
</p>
<h3 id="section-7">7. Disclaimer of Warranty</h3> <h3 id="section-7">7. Disclaimer of Warranty</h3>
Covered code is provided under this license on an "as is" <p>
Covered code is provided under this license on an "as is"
basis, without warranty of any kind, either expressed or implied, including, without 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 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 particular purpose or non-infringing. The entire risk as to the quality and performance of
...@@ -300,6 +345,8 @@ copyright and license as the original code. The copyright of the ported source c ...@@ -300,6 +345,8 @@ copyright and license as the original code. The copyright of the ported source c
servicing, repair or correction. This disclaimer of warranty constitutes an essential part 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 of this license. No use of any covered code is authorized hereunder except under this
disclaimer. disclaimer.
</p>
<h3 id="section-8">8. Termination</h3> <h3 id="section-8">8. Termination</h3>
<p id="section-8.1">8.1. This License and the rights granted hereunder will terminate <p id="section-8.1">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 automatically if You fail to comply with terms herein and fail to cure such breach
...@@ -313,8 +360,7 @@ copyright and license as the original code. The copyright of the ported source c ...@@ -313,8 +360,7 @@ copyright and license as the original code. The copyright of the ported source c
(the Initial Developer or Contributor against whom You file such action is referred to (the Initial Developer or Contributor against whom You file such action is referred to
as "Participant") alleging that: as "Participant") alleging that:
</p> </p>
<ol type="a"> <p id="section-8.2-a">8.2.a. such Participant's Contributor Version directly or indirectly
<li id="section-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 infringes any patent, then any and all rights granted by such Participant to You under
Sections <a href="#section-2.1">2.1</a> and/or <a href="#section-2.2">2.2</a> of this Sections <a href="#section-2.1">2.1</a> and/or <a href="#section-2.2">2.2</a> of this
License shall, upon 60 days notice from Participant terminate prospectively, unless if License shall, upon 60 days notice from Participant terminate prospectively, unless if
...@@ -327,12 +373,13 @@ copyright and license as the original code. The copyright of the ported source c ...@@ -327,12 +373,13 @@ copyright and license as the original code. The copyright of the ported source c
Participant to You under Sections <a href="#section-2.1">2.1</a> and/or Participant to You under Sections <a href="#section-2.1">2.1</a> and/or
<a href="#section-2.2">2.2</a> automatically terminate at the expiration of the 60 day <a href="#section-2.2">2.2</a> automatically terminate at the expiration of the 60 day
notice period specified above. notice period specified above.
</li><li id="section-8.2-b">any software, hardware, or device, other than such Participant's </p>
<p id="section-8.2-b">8.2.b. any software, hardware, or device, other than such Participant's
Contributor Version, directly or indirectly infringes any patent, then any rights Contributor Version, directly or indirectly infringes any patent, then any rights
granted to You by such Participant under Sections 2.1(<a href="#section-2.1-b">b</a>) granted to You by such Participant under Sections 2.1(<a href="#section-2.1-b">b</a>)
and 2.2(<a href="#section-2.2-b">b</a>) are revoked effective as of the date You first and 2.2(<a href="#section-2.2-b">b</a>) are revoked effective as of the date You first
made, used, sold, distributed, or had made, Modifications made by that Participant. made, used, sold, distributed, or had made, Modifications made by that Participant.
</li></ol> </p>
<p id="section-8.3">8.3. If You assert a patent infringement claim against Participant <p id="section-8.3">8.3. If You assert a patent infringement claim against Participant
alleging that such Participant's Contributor Version directly or indirectly infringes alleging that such Participant's Contributor Version directly or indirectly infringes
...@@ -350,9 +397,9 @@ copyright and license as the original code. The copyright of the ported source c ...@@ -350,9 +397,9 @@ copyright and license as the original code. The copyright of the ported source c
termination. termination.
</p> </p>
<h3 id="section-9">9. Limitation of Liability</h3> <h3 id="section-9">9. Limitation of Liability</h3>
<p>
Under no circumstances and under no legal theory, whether Under no circumstances and under no legal theory, whether
tort (including negligence), contract, or otherwise, shall you, the initial developer, 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 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 such parties, be liable to any person for any indirect, special, incidental, or
...@@ -364,42 +411,54 @@ copyright and license as the original code. The copyright of the ported source c ...@@ -364,42 +411,54 @@ copyright and license as the original code. The copyright of the ported source c
applicable law prohibits such limitation. Some jurisdictions do not allow the exclusion applicable law prohibits such limitation. Some jurisdictions do not allow the exclusion
or limitation of incidental or consequential damages, so this exclusion and limitation or limitation of incidental or consequential damages, so this exclusion and limitation
may not apply to you. may not apply to you.
<h3 id="section-10">10. United States Government End Users</h3> </p>
<h3 id="section-10">10. United States Government End Users</h3>
<p>
The Covered Code is a "commercial item", as that term is defined in 48 The Covered Code is a "commercial item", as that term is defined in 48
C.F.R. 2.101 (October 1995), consisting of C.F.R. 2.101 (October 1995), consisting of
"commercial computer software" and "commercial computer software documentation", as such "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. 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 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. acquire Covered Code with only those rights set forth herein.
<h3 id="section-11">11. Miscellaneous</h3> </p>
This License represents the complete agreement concerning subject matter hereof. If
<h3 id="section-11">11. Miscellaneous</h3>
<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 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 reformed only to the extent necessary to make it enforceable. This License shall be
governed by <u>Swiss</u> law provisions (except to the extent applicable law, if any, governed by <em class="u">Swiss</em> law provisions (except to the extent applicable law, if any,
provides otherwise), excluding its conflict-of-law provisions. With respect to 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 disputes in which at least one party is a citizen of, or an entity chartered or
registered to do business in <u>Switzerland</u>, any litigation relating to registered to do business in <em class="u">Switzerland</em>, any litigation relating to
this License shall be subject to the jurisdiction of <u>Switzerland</u>, this License shall be subject to the jurisdiction of <em class="u">Switzerland</em>,
with the losing party responsible for costs, including without limitation, court with the losing party responsible for costs, including without limitation, court
costs and reasonable attorneys' fees and expenses. The application of the United costs and reasonable attorneys' fees and expenses. The application of the United
Nations Convention on Contracts for the International Sale of Goods is expressly 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 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. shall be construed against the drafter shall not apply to this License.
<h3 id="section-12">12. Responsibility for Claims</h3> </p>
As between Initial Developer and the Contributors, each party is responsible for <h3 id="section-12">12. Responsibility for Claims</h3>
claims and damages arising, directly or indirectly, out of its utilization of rights <p>
under this License and You agree to work with Initial Developer and Contributors to As between Initial Developer and the Contributors, each party is responsible for
distribute such responsibility on an equitable basis. Nothing herein is intended or claims and damages arising, directly or indirectly, out of its utilization of rights
shall be deemed to constitute any admission of liability. under this License and You agree to work with Initial Developer and Contributors to
<h3 id="section-13">13. Multiple-Licensed Code</h3> distribute such responsibility on an equitable basis. Nothing herein is intended or
Initial Developer may designate portions of the Covered Code as shall be deemed to constitute any admission of liability.
"Multiple-Licensed". "Multiple-Licensed" means that the Initial Developer permits </p>
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 <h3 id="section-13">13. Multiple-Licensed Code</h3>
described in <a href="#exhibit-a">Exhibit A</a>. <p>
<h3 id="exhibit-a">Exhibit A</h3> 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 <a href="#exhibit-a">Exhibit A</a>.
</p>
<h3 id="exhibit-a">Exhibit A</h3>
<pre> <pre>
Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html). Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
Initial Developer: H2 Group Initial Developer: H2 Group
......
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- <!--
Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html). Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
...@@ -17,17 +16,23 @@ H2 Database Engine ...@@ -17,17 +16,23 @@ H2 Database Engine
Welcome to H2, the free SQL database engine. Welcome to H2, the free SQL database engine.
</p> </p>
<br />
<p>
<a href="quickstartText.html" style="font-size: 16px; font-weight: bold">Quickstart</a> <a href="quickstartText.html" style="font-size: 16px; font-weight: bold">Quickstart</a>
<br /> <br />
Click here to get a fast overview. Click here to get a fast overview.
<br /><br /> </p>
<p>
<a href="tutorial.html" style="font-size: 16px; font-weight: bold">Tutorial</a> <a href="tutorial.html" style="font-size: 16px; font-weight: bold">Tutorial</a>
<br /> <br />
Go through the samples. Go through the samples.
<br /><br /> </p>
<p>
<a href="features.html" style="font-size: 16px; font-weight: bold">Features</a> <a href="features.html" style="font-size: 16px; font-weight: bold">Features</a>
<br /> <br />
See what this database can do and how to use these features. See what this database can do and how to use these features.
<br /><br /> </p>
</div></td></tr></table></body></html> </div></td></tr></table></body></html>
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- <!--
Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html). Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
...@@ -17,17 +16,23 @@ H2 Database Engine ...@@ -17,17 +16,23 @@ H2 Database Engine
ようこそ、無料のSQLデータベース、H2へ ようこそ、無料のSQLデータベース、H2へ
</p> </p>
<br />
<p>
<a href="quickstartText_ja.html" style="font-size: 16px; font-weight: bold">クイックスタート</a> <a href="quickstartText_ja.html" style="font-size: 16px; font-weight: bold">クイックスタート</a>
<br /> <br />
Click here to get a fast overview. Click here to get a fast overview.
<br /><br /> </p>
<p>
<a href="tutorial_ja.html" style="font-size: 16px; font-weight: bold">チュートリアル</a> <a href="tutorial_ja.html" style="font-size: 16px; font-weight: bold">チュートリアル</a>
<br /> <br />
Go through the samples. Go through the samples.
<br /><br /> </p>
<p>
<a href="features.html" style="font-size: 16px; font-weight: bold">特徴</a> <a href="features.html" style="font-size: 16px; font-weight: bold">特徴</a>
<br /> <br />
See what this database can do and how to use these features. See what this database can do and how to use these features.
<br /><br /> </p>
</div></td></tr></table></body></html> </div></td></tr></table></body></html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--
-->
<!-- Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html). --> <!-- Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html). -->
<html><head><meta http-equiv="Content-Type" content="text/html;charset=utf-8" /><title> <html>
<head><meta http-equiv="Content-Type" content="text/html;charset=utf-8" /><title>
H2 Database Engine H2 Database Engine
</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /> </title><link rel="stylesheet" type="text/css" href="stylesheet.css" />
<link rel="alternate" type="application/atom+xml" title="H2 Newsfeed" href="http://www.h2database.com/html/newsfeed-atom.xml" /> <link rel="alternate" type="application/atom+xml" title="H2 Newsfeed" href="http://www.h2database.com/html/newsfeed-atom.xml" />
......
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- <!--
Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html). Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
......
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- <!--
Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html). Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
...@@ -20,9 +19,9 @@ Quickstart ...@@ -20,9 +19,9 @@ Quickstart
<br /><a name="embedding"></a> <br /><a name="embedding"></a>
<h2>Embedding H2 in an Application</h2> <h2>Embedding H2 in an Application</h2>
<p>
This database can be used in embedded mode, or in server mode. To use it in embedded mode, you need to: This database can be used in embedded mode, or in server mode. To use it in embedded mode, you need to:
</p>
<ul> <ul>
<li>Add <code>h2.jar</code> to the classpath <li>Add <code>h2.jar</code> to the classpath
</li><li>Use the JDBC driver class: <code>org.h2.Driver</code> </li><li>Use the JDBC driver class: <code>org.h2.Driver</code>
...@@ -31,19 +30,24 @@ This database can be used in embedded mode, or in server mode. To use it in embe ...@@ -31,19 +30,24 @@ This database can be used in embedded mode, or in server mode. To use it in embe
<br /><a name="h2_console"></a> <br /><a name="h2_console"></a>
<h2>The H2 Console Application</h2> <h2>The H2 Console Application</h2>
<p>
The Console lets you access a SQL database using a browser interface. The Console lets you access a SQL database using a browser interface.
<br /> <br />
<img src="images/console.png" alt="Web Browser - H2 Console Server - H2 Database" /> <img src="images/console.png" alt="Web Browser - H2 Console Server - H2 Database" />
<br /> <br />
If you don't have Windows XP, or if something does not work as expected, If you don't have Windows XP, or if something does not work as expected,
please see the detailed description in the <a href="tutorial.html">Tutorial</a>. please see the detailed description in the <a href="tutorial.html">Tutorial</a>.
</p>
<h3>Step-by-Step</h3> <h3>Step-by-Step</h3>
<h4>Installation</h4> <h4>Installation</h4>
<p>
Install the software using the Windows Installer (if you did not yet do that). Install the software using the Windows Installer (if you did not yet do that).
</p>
<h4>Start the Console</h4> <h4>Start the Console</h4>
<p>
Click <span class="button">Start</span>, Click <span class="button">Start</span>,
<span class="button">All Programs</span>, <span class="button">All Programs</span>,
<span class="button">H2</span>, and <span class="button">H2</span>, and
...@@ -54,31 +58,42 @@ A new console window appears:<br /> ...@@ -54,31 +58,42 @@ A new console window appears:<br />
Also, a new browser page should open with the URL http://localhost:8082. 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 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. on your machine, you can let the firewall block these connections. Only local connections are required at this time.
</p>
<h4>Login</h4> <h4>Login</h4>
<p>
Select <span class="button">Generic H2</span> and click <span class="button">Connect</span>:<br /> Select <span class="button">Generic H2</span> and click <span class="button">Connect</span>:<br />
<img class="screenshot" src="images/quickstart-3.png" alt="screenshot: Login screen" /><br /> <img class="screenshot" src="images/quickstart-3.png" alt="screenshot: Login screen" /><br />
You are now logged in. You are now logged in.
</p>
<h4>Sample</h4> <h4>Sample</h4>
<p>
Click on the <span class="button">Sample SQL Script</span>:<br /> Click on the <span class="button">Sample SQL Script</span>:<br />
<img class="screenshot" src="images/quickstart-4.png" alt="screenshot: click on the sample SQL script" /><br /> <img class="screenshot" src="images/quickstart-4.png" alt="screenshot: click on the sample SQL script" /><br />
The SQL commands appear in the command area.<br /> The SQL commands appear in the command area.<br />
</p>
<h4>Execute</h4> <h4>Execute</h4>
<p>
Click <span class="button">Run</span>:<br /> Click <span class="button">Run</span>:<br />
<img class="screenshot" src="images/quickstart-5.png" alt="screenshot: click Run" /><br /> <img class="screenshot" src="images/quickstart-5.png" alt="screenshot: click Run" /><br />
On the left side, a new entry TEST is added below the database icon. On the left side, a new entry TEST is added below the database icon.
The operations and results of the statements are shown below the script.<br /> The operations and results of the statements are shown below the script.<br />
<img class="screenshot" src="images/quickstart-6.png" alt="screenshot: see the result" /><br /> <img class="screenshot" src="images/quickstart-6.png" alt="screenshot: see the result" /><br />
</p>
<h4>Disconnect</h4> <h4>Disconnect</h4>
<p>
Click on <span class="button">Disconnect</span>:<br /> Click on <span class="button">Disconnect</span>:<br />
<img src="images/icon_disconnect.gif" alt="Disconnect icon" /><br /> <img src="images/icon_disconnect.gif" alt="Disconnect icon" /><br />
to close the database. to close the database.
</p>
<h4>End</h4> <h4>End</h4>
<p>
Close the console window. Close the console window.
For more information, see the <a href="tutorial.html">Tutorial</a>. For more information, see the <a href="tutorial.html">Tutorial</a>.
</p>
</div></td></tr></table></body></html> </div></td></tr></table></body></html>
...@@ -19,8 +19,9 @@ Quickstart ...@@ -19,8 +19,9 @@ Quickstart
<br /><a name="embedding"></a> <br /><a name="embedding"></a>
<h2>Embedding H2 in an Application</h2> <h2>Embedding H2 in an Application</h2>
<p>
This database can be used in embedded mode, or in server mode. To use it in embedded mode, you need to: This database can be used in embedded mode, or in server mode. To use it in embedded mode, you need to:
</p>
<ul> <ul>
<li>Add <code>h2.jar</code> to the classpath <li>Add <code>h2.jar</code> to the classpath
...@@ -30,18 +31,23 @@ This database can be used in embedded mode, or in server mode. To use it in embe ...@@ -30,18 +31,23 @@ This database can be used in embedded mode, or in server mode. To use it in embe
<br /><a name="h2_console"></a> <br /><a name="h2_console"></a>
<h2>H2 コンソール アプリケーション</h2> <h2>H2 コンソール アプリケーション</h2>
<p>
このコンソールはブラウザインターフェースを使ってSQL データベースにアクセスします。 このコンソールはブラウザインターフェースを使ってSQL データベースにアクセスします。
<br /> <br />
<img src="images/console.png" alt="Web Browser - H2 Console Server - H2 Database" /> <img src="images/console.png" alt="Web Browser - H2 Console Server - H2 Database" />
<br /> <br />
Windows XPをご使用でなかったり、 期待通りに機能しない場合は、 <a href="tutorial.html">チュートリアル</a> 内の 詳細説明をご覧下さい。 Windows XPをご使用でなかったり、 期待通りに機能しない場合は、 <a href="tutorial.html">チュートリアル</a> 内の 詳細説明をご覧下さい。
</p>
<h3>手順</h3> <h3>手順</h3>
<h4>インストール</h4> <h4>インストール</h4>
<p>
Windows インストーラーを使用してソフトウェアをインストールしましょう (まだインストールされていない場合)。 Windows インストーラーを使用してソフトウェアをインストールしましょう (まだインストールされていない場合)。
</p>
<h4>コンソールを起動する</h4> <h4>コンソールを起動する</h4>
<p>
<span class="button">スタート</span> <span class="button">スタート</span>
<span class="button">すべてのプログラム</span> <span class="button">すべてのプログラム</span>
<span class="button">H2</span> <span class="button">H2</span>
...@@ -51,29 +57,40 @@ Windows インストーラーを使用してソフトウェアをインストー ...@@ -51,29 +57,40 @@ Windows インストーラーを使用してソフトウェアをインストー
<img class="screenshot" src="images/quickstart-2.png" alt="screenshot: H2 Running" /><br /> <img class="screenshot" src="images/quickstart-2.png" alt="screenshot: H2 Running" /><br />
新しいブラウザで URL http://localhost:8082/ にアクセスして下さい。 ファイアーウォールによるセキュリティ警告を設定することができます。 新しいブラウザで URL http://localhost:8082/ にアクセスして下さい。 ファイアーウォールによるセキュリティ警告を設定することができます。
外部ネットワークから あなたのマシンのデータベースにアクセスされたくないのであれば、ファイアーウォールが他の接続を遮断します。 ローカル接続のみ必要です。 外部ネットワークから あなたのマシンのデータベースにアクセスされたくないのであれば、ファイアーウォールが他の接続を遮断します。 ローカル接続のみ必要です。
</p>
<h4>ログイン</h4> <h4>ログイン</h4>
<p>
<span class="button">Generic H2</span>を選び、<span class="button">Connect</span>をクリックします:<br /> <span class="button">Generic H2</span>を選び、<span class="button">Connect</span>をクリックします:<br />
<img class="screenshot" src="images/quickstart-3.png" alt="screenshot: Login screen" /><br /> <img class="screenshot" src="images/quickstart-3.png" alt="screenshot: Login screen" /><br />
ログインされました。 ログインされました。
</p>
<h4>サンプル</h4> <h4>サンプル</h4>
<p>
<span class="button">Sample SQL Script</span>をクリックします。: <br /> <span class="button">Sample SQL Script</span>をクリックします。: <br />
<img class="screenshot" src="images/quickstart-4.png" alt="screenshot: click on the sample SQL script" /><br /> <img class="screenshot" src="images/quickstart-4.png" alt="screenshot: click on the sample SQL script" /><br />
SQLコマンドがコマンドエリアに表示されます。<br /> SQLコマンドがコマンドエリアに表示されます。<br />
</p>
<h4>実行する</h4> <h4>実行する</h4>
<p>
<span class="button">Run</span>をクリックします:<br /> <span class="button">Run</span>をクリックします:<br />
<img class="screenshot" src="images/quickstart-5.png" alt="screenshot: click Run" /><br /> <img class="screenshot" src="images/quickstart-5.png" alt="screenshot: click Run" /><br />
左側のデータベースアイコンの下に、 新しいテーブル TEST が追加されます。動作とステートメントの結果は、スクリプトの下に表示されます。<br /> 左側のデータベースアイコンの下に、 新しいテーブル TEST が追加されます。動作とステートメントの結果は、スクリプトの下に表示されます。<br />
<img class="screenshot" src="images/quickstart-6.png" alt="screenshot: see the result" /><br /> <img class="screenshot" src="images/quickstart-6.png" alt="screenshot: see the result" /><br />
</p>
<h4>切断</h4> <h4>切断</h4>
<p>
<span class="button">Disconnect</span>をクリックします:<br /> <span class="button">Disconnect</span>をクリックします:<br />
<img src="images/icon_disconnect.gif" alt="Disconnect icon" /><br /> <img src="images/icon_disconnect.gif" alt="Disconnect icon" /><br />
データベースを閉じます。 データベースを閉じます。
</p>
<h4>終了</h4> <h4>終了</h4>
<p>
コンソールウィンドウを閉じます。詳細は<a href="tutorial.html">チュートリアル</a>をご覧下さい。 コンソールウィンドウを閉じます。詳細は<a href="tutorial.html">チュートリアル</a>をご覧下さい。
</p>
</div></td></tr></table></body></html> </div></td></tr></table></body></html>
...@@ -101,6 +101,11 @@ a:hover { ...@@ -101,6 +101,11 @@ a:hover {
text-decoration: underline; text-decoration: underline;
} }
em.u {
text-decoration: underline;
font-style: normal;
}
.button { .button {
border: 1px outset #800; border: 1px outset #800;
margin: 0px 2px 0px 2px; margin: 0px 2px 0px 2px;
......
...@@ -100,6 +100,11 @@ a:hover { ...@@ -100,6 +100,11 @@ a:hover {
text-decoration: underline; text-decoration: underline;
} }
em.u {
text-decoration: underline;
font-style: normal;
}
.screenshot { .screenshot {
border: 1px outset #888; border: 1px outset #888;
padding: 10px; padding: 10px;
......
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- <!--
Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html). Copyright 2004-2007 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
...@@ -92,31 +91,40 @@ To change this, go to 'Preferences' and select 'Allow connections from other com ...@@ -92,31 +91,40 @@ To change this, go to 'Preferences' and select 'Allow connections from other com
</p> </p>
<h3>Native Version</h3> <h3>Native Version</h3>
<p>
The native version does not require Java, because it is compiled using GCJ. The native version does not require Java, because it is compiled using GCJ.
However H2 does currently not run stable with GCJ on Windows However H2 does currently not run stable with GCJ on Windows
It is possible to compile the software to different platforms. It is possible to compile the software to different platforms.
</p>
<h3>Testing Java</h3> <h3>Testing Java</h3>
<p>
To check the Java version you have installed, open a command prompt and type: To check the Java version you have installed, open a command prompt and type:
<pre> <pre>
java -version java -version
</pre> </pre>
If you get an error message, you may need to add the Java binary directory to the path environment variable. If you get an error message, you may need to add the Java binary directory to the path environment variable.
</p>
<h3>Error Message 'Port is in use'</h3> <h3>Error Message 'Port is in use'</h3>
<p>
You can only start one instance of the H2 Console, You can only start one instance of the H2 Console,
otherwise you will get the following error message: otherwise you will get the following error message:
<code>Port is in use, maybe another ... server already running on...</code>. <code>Port is in use, maybe another ... server already running on...</code>.
It is possible to start multiple console applications on the same computer (using different ports), It is possible to start multiple console applications on the same computer (using different ports),
but this is usually not required as the console supports multiple concurrent connections. but this is usually not required as the console supports multiple concurrent connections.
</p>
<h3>Using another Port</h3> <h3>Using another Port</h3>
<p>
If the port is in use by another application, you may want to start the H2 Console on a different port. If the port is in use by another application, you may want to start the H2 Console on a different port.
This can be done by changing the port in the file .h2.server.properties. This file is stored This can be done by changing the port in the file .h2.server.properties. This file is stored
in the user directory (for Windows, this is usually in "Documents and Settings/&lt;username&gt;"). in the user directory (for Windows, this is usually in "Documents and Settings/&lt;username&gt;").
The relevant entry is webPort. The relevant entry is webPort.
</p>
<h3>Starting Successfully</h3> <h3>Starting Successfully</h3>
<p>
If starting the server from a console window was successful, If starting the server from a console window was successful,
a new window will open and display the following text: a new window will open and display the following text:
<pre> <pre>
...@@ -124,22 +132,29 @@ H2 Server running on port 9092 ...@@ -124,22 +132,29 @@ H2 Server running on port 9092
Webserver running on https://localhost:8082/ Webserver running on https://localhost:8082/
</pre> </pre>
Don't click inside this window; otherwise you might block the application (if you have the Fast-Edit mode enabled). Don't click inside this window; otherwise you might block the application (if you have the Fast-Edit mode enabled).
</p>
<h3>Connecting to the Server using a Browser</h3> <h3>Connecting to the Server using a Browser</h3>
<p>
If the server started successfully, you can connect to it using a web browser. 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). 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 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: 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. http://192.168.0.2:8082. If you enabled SSL on the server side, the URL needs to start with HTTPS.
</p>
<h3>Multiple Concurrent Sessions</h3> <h3>Multiple Concurrent Sessions</h3>
<p>
Multiple concurrent browser sessions are supported. As that the database objects reside on the server, Multiple concurrent browser sessions are supported. As that the database objects reside on the server,
the amount of concurrent work is limited by the memory available to the server application. the amount of concurrent work is limited by the memory available to the server application.
</p>
<h3>Application Properties</h3> <h3>Application Properties</h3>
<p>
Starting the server will create a configuration file in you local home directory called <code>.h2.server.properties</code>. Starting the server will create a configuration file in you local home directory called <code>.h2.server.properties</code>.
For Windows installations, this file will be in the directory <code>C:\Documents and Settings\[username]</code>. For Windows installations, this file will be in the directory <code>C:\Documents and Settings\[username]</code>.
This file contains the settings of the application. This file contains the settings of the application.
</p>
<h3>Login</h3> <h3>Login</h3>
<p> <p>
...@@ -152,8 +167,10 @@ Application Properties file. ...@@ -152,8 +167,10 @@ Application Properties file.
</p> </p>
<h3>Error Messages</h3> <h3>Error Messages</h3>
<p>
Error messages in are shown in red. You can show/hide the stack trace of the exception Error messages in are shown in red. You can show/hide the stack trace of the exception
by clicking on the message. by clicking on the message.
</p>
<h3>Adding Database Drivers</h3> <h3>Adding Database Drivers</h3>
<p> <p>
...@@ -169,15 +186,19 @@ Only the Java version supports additional drivers (this feature is not supported ...@@ -169,15 +186,19 @@ Only the Java version supports additional drivers (this feature is not supported
</p> </p>
<h3>Using the Application</h3> <h3>Using the Application</h3>
<p>
The application has three main panels, the toolbar on top, the tree on the left and the query / result panel on the right. The application has three main panels, the toolbar on top, the tree on the left and the query / result panel on the right.
The database objects (for example, tables) are listed on the left panel. The database objects (for example, tables) are listed on the left panel.
Type in a SQL command on the query panel and click 'Run'. The result of the command appears just below the command. Type in a SQL command on the query panel and click 'Run'. The result of the command appears just below the command.
</p>
<h3>Inserting Table Names or Column Names</h3> <h3>Inserting Table Names or Column Names</h3>
<p>
The table name and column names can be inserted in the script by clicking them in the tree. The table name and column names can be inserted in the script by clicking them in the tree.
If you click on a table while the query is empty, a 'SELECT * FROM ...' is added as well. If you click on a table while the query is empty, a 'SELECT * FROM ...' is added as well.
While typing a query, the table that was used is automatically expanded in the tree. While typing a query, the table that was used is automatically expanded in the tree.
For, example if you type 'SELECT * FROM TEST T WHERE T.' then the table TEST is automatically expanded in the tree. For, example if you type 'SELECT * FROM TEST T WHERE T.' then the table TEST is automatically expanded in the tree.
</p>
<h3>Disconnecting and Stopping the Application</h3> <h3>Disconnecting and Stopping the Application</h3>
<p> <p>
...@@ -192,6 +213,7 @@ or close the console window. ...@@ -192,6 +213,7 @@ or close the console window.
<br /><a name="connecting_using_jdbc"></a> <br /><a name="connecting_using_jdbc"></a>
<h2>Connecting to a Database using JDBC</h2> <h2>Connecting to a Database using JDBC</h2>
<p>
To connect to a database, a Java application first needs to load the database driver, 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: and then get a connection. A simple way to do that is using the following code:
<pre> <pre>
...@@ -213,19 +235,25 @@ The database URL always needs to start with <code>jdbc:h2:</code> ...@@ -213,19 +235,25 @@ The database URL always needs to start with <code>jdbc:h2:</code>
to be recognized by this database. The second parameter in the <code>getConnection()</code> call to be recognized by this database. The second parameter in the <code>getConnection()</code> call
is the user name ('sa' for System Administrator in this example). The third parameter is the password. is the user name ('sa' for System Administrator in this example). The third parameter is the password.
Please note that in this database, user names are not case sensitive, but passwords are case sensitive. Please note that in this database, user names are not case sensitive, but passwords are case sensitive.
</p>
<br /><a name="creating_new_databases"></a> <br /><a name="creating_new_databases"></a>
<h2>Creating New Databases</h2> <h2>Creating New Databases</h2>
<p>
By default, if the database specified in the URL does not yet exist, a new (empty) By default, if the database specified in the URL does not yet exist, a new (empty)
database is created automatically. The user that created the database automatically becomes database is created automatically. The user that created the database automatically becomes
the administrator of this database. the administrator of this database.
</p>
<br /><a name="using_server"></a> <br /><a name="using_server"></a>
<h2>Using the Server</h2> <h2>Using the Server</h2>
<p>
H2 currently supports three servers: a Web Server, a TCP Server and an ODBC Server. H2 currently supports three servers: a Web Server, a TCP Server and an ODBC Server.
The servers can be started in different ways. The servers can be started in different ways.
</p>
<h3>Starting the Server from Command Line</h3> <h3>Starting the Server from Command Line</h3>
<p>
To start the Server from the command line with the default settings, run To start the Server from the command line with the default settings, run
<pre> <pre>
java org.h2.tools.Server java org.h2.tools.Server
...@@ -236,16 +264,22 @@ java org.h2.tools.Server -? ...@@ -236,16 +264,22 @@ java org.h2.tools.Server -?
</pre> </pre>
There are options available to use a different ports, and start or not start There are options available to use a different ports, and start or not start
parts of the Server and so on. For details, see the API documentation of the Server tool. parts of the Server and so on. For details, see the API documentation of the Server tool.
</p>
<h3>Connecting to the TCP Server</h3> <h3>Connecting to the TCP Server</h3>
<p>
To remotly connect to a database using the TCP server, use the following driver and database URL: To remotly connect to a database using the TCP server, use the following driver and database URL:
</p>
<ul> <ul>
<li>JDBC driver class: org.h2.Driver <li>JDBC driver class: org.h2.Driver
</li><li>Database URL: jdbc:h2:tcp://localhost/~/test </li><li>Database URL: jdbc:h2:tcp://localhost/~/test
</li></ul> </li></ul>
<p>
For details about the database URL, see also in Features. For details about the database URL, see also in Features.
</p>
<h3>Starting the Server within an Application</h3> <h3>Starting the Server within an Application</h3>
<p>
It is also possible to start and stop a Server from within an application. Sample code: It is also possible to start and stop a Server from within an application. Sample code:
<pre> <pre>
import org.h2.tools.Server; import org.h2.tools.Server;
...@@ -256,8 +290,10 @@ Server server = Server.createTcpServer(args).start(); ...@@ -256,8 +290,10 @@ Server server = Server.createTcpServer(args).start();
// stop the TCP Server // stop the TCP Server
server.stop(); server.stop();
</pre> </pre>
</p>
<h3>Stopping a TCP Server from Another Process</h3> <h3>Stopping a TCP Server from Another Process</h3>
<p>
The TCP Server can be stopped from another process. The TCP Server can be stopped from another process.
To stop the server from the command line, run: To stop the server from the command line, run:
<pre> <pre>
...@@ -271,9 +307,12 @@ This function will call System.exit on the server. ...@@ -271,9 +307,12 @@ This function will call System.exit on the server.
This function should be called after all connection to the databases are closed This function should be called after all connection to the databases are closed
to avoid recovery when the databases are opened the next time. to avoid recovery when the databases are opened the next time.
To stop remote server, remote connections must be enabled on the server. To stop remote server, remote connections must be enabled on the server.
</p>
<h3>Limitations of the Server</h3> <h3>Limitations of the Server</h3>
<p>
There currently are a few limitations when using the server or cluster mode: There currently are a few limitations when using the server or cluster mode:
</p>
<ul> <ul>
<li>Statement.cancel() is only supported in embedded mode. <li>Statement.cancel() is only supported in embedded mode.
A connection can only execute one operation at a time in server or cluster mode, A connection can only execute one operation at a time in server or cluster mode,
...@@ -284,17 +323,22 @@ There currently are a few limitations when using the server or cluster mode: ...@@ -284,17 +323,22 @@ There currently are a few limitations when using the server or cluster mode:
<br /><a name="using_hibernate"></a> <br /><a name="using_hibernate"></a>
<h2>Using Hibernate</h2> <h2>Using Hibernate</h2>
<p>
This database supports Hibernate version 3.1 and newer. You can use the HSQLDB Dialect, This database supports Hibernate version 3.1 and newer. You can use the HSQLDB Dialect,
or the native H2 Dialect that is available in the file src/tools/org/h2/tools/hibernate/H2Dialect.txt. or the native H2 Dialect that is available in the file src/tools/org/h2/tools/hibernate/H2Dialect.txt.
The H2 dialect is included in newer version of Hibernate. For versions where the dialect is missing, you need to copy the file The H2 dialect is included in newer version of Hibernate. For versions where the dialect is missing, you need to copy the file
into the folder src\org\hibernate\dialect (Hibernate 3.1), rename it to H2Dialect.java and re-compile hibernate. into the folder src\org\hibernate\dialect (Hibernate 3.1), rename it to H2Dialect.java and re-compile hibernate.
</p>
<br /><a name="web_applications"></a> <br /><a name="web_applications"></a>
<h2>Using Databases in Web Applications</h2> <h2>Using Databases in Web Applications</h2>
<p>
There are multiple ways to access a database from within web There are multiple ways to access a database from within web
applications. Here are some examples if you use Tomcat or JBoss. applications. Here are some examples if you use Tomcat or JBoss.
</p>
<h3>Embedded Mode</h3> <h3>Embedded Mode</h3>
<p>
The (currently) most simple solution is to use the database in the The (currently) most simple solution is to use the database in the
embedded mode, that means open a connection in your application when embedded mode, that means open a connection in your application when
it starts (a good solution is using a Servlet Listener, see below), or it starts (a good solution is using a Servlet Listener, see below), or
...@@ -312,11 +356,15 @@ that. In the application, an idea is to use one connection per ...@@ -312,11 +356,15 @@ that. In the application, an idea is to use one connection per
Session, or even one connection per request (action). Those Session, or even one connection per request (action). Those
connections should be closed after use if possible (but it's not that connections should be closed after use if possible (but it's not that
bad if they don't get closed). bad if they don't get closed).
</p>
<h3>Server Mode</h3> <h3>Server Mode</h3>
<p>
The server mode is similar, but it allows you to run the server in another process. The server mode is similar, but it allows you to run the server in another process.
</p>
<h3>Using a Servlet Listener to Start and Stop a Database</h3> <h3>Using a Servlet Listener to Start and Stop a Database</h3>
<p>
Add the h2.jar file your web application, and Add the h2.jar file your web application, and
add the following snippet to your web.xml file (after context-param and before filter): add the following snippet to your web.xml file (after context-param and before filter):
<pre> <pre>
...@@ -324,15 +372,18 @@ add the following snippet to your web.xml file (after context-param and before f ...@@ -324,15 +372,18 @@ add the following snippet to your web.xml file (after context-param and before f
&lt;listener-class>org.h2.server.web.DbStarter&lt;/listener-class> &lt;listener-class>org.h2.server.web.DbStarter&lt;/listener-class>
&lt;/listener> &lt;/listener>
</pre> </pre>
For details on how to access the database, see the code DbStarter.java For details on how to access the database, see the code DbStarter.java
</p>
<br /><a name="csv"></a> <br /><a name="csv"></a>
<h2>CSV (Comma Separated Values) Support</h2> <h2>CSV (Comma Separated Values) Support</h2>
<p>
The CSV file support can be used inside the database using the functions CSVREAD and CSVWRITE, The CSV file support can be used inside the database using the functions CSVREAD and CSVWRITE,
and the CSV library can be used outside the database as a standalone tool. and the CSV library can be used outside the database as a standalone tool.
</p>
<h3>Writing a CSV File from Within a Database</h3> <h3>Writing a CSV File from Within a Database</h3>
<p>
The built-in function CSVWRITE can be used to create a CSV file from a query. The built-in function CSVWRITE can be used to create a CSV file from a query.
Example: Example:
<pre> <pre>
...@@ -340,14 +391,18 @@ CREATE TABLE TEST(ID INT, NAME VARCHAR); ...@@ -340,14 +391,18 @@ CREATE TABLE TEST(ID INT, NAME VARCHAR);
INSERT INTO TEST VALUES(1, 'Hello'), (2, 'World'); INSERT INTO TEST VALUES(1, 'Hello'), (2, 'World');
CALL CSVWRITE('test.csv', 'SELECT * FROM TEST'); CALL CSVWRITE('test.csv', 'SELECT * FROM TEST');
</pre> </pre>
</p>
<h3>Reading a CSV File from Within a Database</h3> <h3>Reading a CSV File from Within a Database</h3>
<p>
A CSV file can be read using the function CSVREAD. Example: A CSV file can be read using the function CSVREAD. Example:
<pre> <pre>
SELECT * FROM CSVREAD('test.csv'); SELECT * FROM CSVREAD('test.csv');
</pre> </pre>
</p>
<h3>Writing a CSV File from a Java Application</h3> <h3>Writing a CSV File from a Java Application</h3>
<p>
The CSV tool can be used in a Java application even when not using a database at all. The CSV tool can be used in a Java application even when not using a database at all.
Example: Example:
<pre> <pre>
...@@ -359,8 +414,10 @@ rs.addRow(new String[]{"Bob Meier", "bob.meier@abcde.abc", "+41123456789"}); ...@@ -359,8 +414,10 @@ rs.addRow(new String[]{"Bob Meier", "bob.meier@abcde.abc", "+41123456789"});
rs.addRow(new String[]{"John Jones", "john.jones@abcde.abc", "+41976543210"}); rs.addRow(new String[]{"John Jones", "john.jones@abcde.abc", "+41976543210"});
Csv.write("test.csv", rs, null); Csv.write("test.csv", rs, null);
</pre> </pre>
</p>
<h3>Reading a CSV File from a Java Application</h3> <h3>Reading a CSV File from a Java Application</h3>
<p>
It is possible to read a CSV file without opening a database. It is possible to read a CSV file without opening a database.
Example: Example:
<pre> <pre>
...@@ -374,16 +431,20 @@ while(rs.next()) { ...@@ -374,16 +431,20 @@ while(rs.next()) {
} }
rs.close(); rs.close();
</pre> </pre>
</p>
<br /><a name="upgrade_backup_restore"></a> <br /><a name="upgrade_backup_restore"></a>
<h2>Upgrade, Backup, and Restore</h2> <h2>Upgrade, Backup, and Restore</h2>
<h3>Database Upgrade</h3> <h3>Database Upgrade</h3>
<p>
The recommended way to upgrade from one version of the database engine to the next The recommended way to upgrade from one version of the database engine to the next
version is to create a backup of the database (in the form of a SQL script) using the old engine, version is to create a backup of the database (in the form of a SQL script) using the old engine,
and then execute the SQL script using the new engine. and then execute the SQL script using the new engine.
</p>
<h3>Backup using the Script Tool</h3> <h3>Backup using the Script Tool</h3>
<p>
There are different ways to backup a database. For example, it is possible to copy the database files. There are different ways to backup a database. For example, it is possible to copy the database files.
However, this is not recommended while the database is in use. Also, the database files are not human readable However, this is not recommended while the database is in use. Also, the database files are not human readable
and quite large. The recommended way to backup a database is to create a compressed SQL script file. and quite large. The recommended way to backup a database is to create a compressed SQL script file.
...@@ -395,8 +456,10 @@ It is also possible to use the SQL command SCRIPT to create the backup of the da ...@@ -395,8 +456,10 @@ It is also possible to use the SQL command SCRIPT to create the backup of the da
For more information about the options, see the SQL command SCRIPT. For more information about the options, see the SQL command SCRIPT.
The backup can be done remotely, however the file will be created on the server side. The backup can be done remotely, however the file will be created on the server side.
The built in FTP server could be used to retrieve the file from the server. The built in FTP server could be used to retrieve the file from the server.
</p>
<h3>Restore from a Script</h3> <h3>Restore from a Script</h3>
<p>
To restore a database from a SQL script file, you can use the RunScript tool: To restore a database from a SQL script file, you can use the RunScript tool:
<pre> <pre>
java org.h2.tools.RunScript -url jdbc:h2:~/test -user sa -script test.zip -options compression zip java org.h2.tools.RunScript -url jdbc:h2:~/test -user sa -script test.zip -options compression zip
...@@ -408,8 +471,10 @@ It is also possible to use the SQL command RUNSCRIPT to execute a SQL script. ...@@ -408,8 +471,10 @@ It is also possible to use the SQL command RUNSCRIPT to execute a SQL script.
SQL script files may contain references to other script files, in the form of SQL script files may contain references to other script files, in the form of
RUNSCRIPT commands. However, when using the server mode, the references script files RUNSCRIPT commands. However, when using the server mode, the references script files
need to be available on the server side. need to be available on the server side.
</p>
<h3>Online Backup</h3> <h3>Online Backup</h3>
<p>
The BACKUP SQL statement and the Backup tool both create a zip file The BACKUP SQL statement and the Backup tool both create a zip file
with all database files. However, the contents of this file are not human readable. with all database files. However, the contents of this file are not human readable.
Other than the SCRIPT statement, the BACKUP statement does not lock the Other than the SCRIPT statement, the BACKUP statement does not lock the
...@@ -420,13 +485,15 @@ BACKUP TO 'backup.zip' ...@@ -420,13 +485,15 @@ BACKUP TO 'backup.zip'
</pre> </pre>
The Backup tool (org.h2.tools.Backup) can not be used to create a online backup; The Backup tool (org.h2.tools.Backup) can not be used to create a online backup;
the database must not be in use while running this program. the database must not be in use while running this program.
</p>
<br /><a name="open_office"></a> <br /><a name="open_office"></a>
<h2>Using OpenOffice Base</h2> <h2>Using OpenOffice Base</h2>
<p>
OpenOffice.org Base supports database access over the JDBC API. To connect to a H2 database OpenOffice.org Base supports database access over the JDBC API. To connect to a H2 database
using OpenOffice Base, you first need to add the JDBC driver to OpenOffice. using OpenOffice Base, you first need to add the JDBC driver to OpenOffice.
The steps to connect to a H2 database are: The steps to connect to a H2 database are:
</p>
<ul> <ul>
<li>Stop OpenOffice, including the autostart <li>Stop OpenOffice, including the autostart
</li><li>Copy h2.jar into the directory &lt;OpenOffice&gt;\program\classes </li><li>Copy h2.jar into the directory &lt;OpenOffice&gt;\program\classes
...@@ -435,21 +502,22 @@ The steps to connect to a H2 database are: ...@@ -435,21 +502,22 @@ The steps to connect to a H2 database are:
</li><li>Example datasource URL: jdbc:h2:c:/temp/test </li><li>Example datasource URL: jdbc:h2:c:/temp/test
</li><li>JDBC driver class: org.h2.Driver </li><li>JDBC driver class: org.h2.Driver
</li></ul> </li></ul>
<p>
Now you can access the database stored in the directory C:/temp. Now you can access the database stored in the directory C:/temp.
</p>
<br /><a name="web_start"></a> <br /><a name="web_start"></a>
<h2>Java Web Start / JNLP</h2> <h2>Java Web Start / JNLP</h2>
<p>
When using Java Web Start / JNLP (Java Network Launch Protocol), permissions tags must be set in the .jnlp file, When using Java Web Start / JNLP (Java Network Launch Protocol), permissions tags must be set in the .jnlp file,
and the application .jar file must be signed. Otherwise, when trying to write to the file system, the following and the application .jar file must be signed. Otherwise, when trying to write to the file system, the following
exception will occur: java.security.AccessControlException: access denied (java.io.FilePermission ... read). exception will occur: java.security.AccessControlException: access denied (java.io.FilePermission ... read).
Example permission tags: Example permission tags:
<pre> <pre>
&lt;security> &lt;security>
&lt;all-permissions/> &lt;all-permissions/>
&lt;/security> &lt;/security>
</pre> </pre>
</p>
</div></td></tr></table></body></html> </div></td></tr></table></body></html>
\ No newline at end of file
...@@ -81,39 +81,55 @@ java -cp h2.jar org.h2.tools.Server ...@@ -81,39 +81,55 @@ java -cp h2.jar org.h2.tools.Server
</p> </p>
<h3>ネイティブ バージョン</h3> <h3>ネイティブ バージョン</h3>
<p>
ネイティブ バージョンはJavaを必要としていません。なぜなら、 これはGCJを使用してコンパイルされるからです。しかし、H2は現在、Windows上のGCJプロジェクトでは実行されません。 異なったプラットフォームでソフトウェアをコンパイルすることが可能です。 ネイティブ バージョンはJavaを必要としていません。なぜなら、 これはGCJを使用してコンパイルされるからです。しかし、H2は現在、Windows上のGCJプロジェクトでは実行されません。 異なったプラットフォームでソフトウェアをコンパイルすることが可能です。
</p>
<h3>Javaをテストする</h3> <h3>Javaをテストする</h3>
<p>
インストールしたJavaのバージョンを調べるためには、 コマンドプロンプトを開き、 下記を入力します: インストールしたJavaのバージョンを調べるためには、 コマンドプロンプトを開き、 下記を入力します:
<pre> <pre>
java -version java -version
</pre> </pre>
もしエラーメッセージが表示されたら、Javaのバイナリディレクトリを環境変数のPathに追加します。 もしエラーメッセージが表示されたら、Javaのバイナリディレクトリを環境変数のPathに追加します。
</p>
<h3>エラーメッセージ 'Port is in use'</h3> <h3>エラーメッセージ 'Port is in use'</h3>
<p>
ひとつのH2コンソールのみ起動することができます。 そうでなければ、次のようなエラーメッセージが表示されます: ひとつのH2コンソールのみ起動することができます。 そうでなければ、次のようなエラーメッセージが表示されます:
<code>Port is in use, maybe another ... server already running on...</code> <code>Port is in use, maybe another ... server already running on...</code>
複数のコンソールアプリケーションを同じコンピューターで起動することは可能です (異なったポートを使用します)、しかし、コンソールが複数の同時接続を維持するということは、普通は必要とされていません。 複数のコンソールアプリケーションを同じコンピューターで起動することは可能です (異なったポートを使用します)、しかし、コンソールが複数の同時接続を維持するということは、普通は必要とされていません。
</p>
<h3>他のポートを使用する</h3> <h3>他のポートを使用する</h3>
<p>
もしポートが他のアプリケーションによって使用されている場合は、H2コンソールを 異なったポートで起動したいはずです。これは、.h2.server.properties.ファイル内のポートを変更することにより実行できます。 このファイルはユーザディレクトリ内に格納されています (Windowsでは通常、"Documents and Settings/&lt;ユーザ名&gt;")。関連する項目はwebPortです。 もしポートが他のアプリケーションによって使用されている場合は、H2コンソールを 異なったポートで起動したいはずです。これは、.h2.server.properties.ファイル内のポートを変更することにより実行できます。 このファイルはユーザディレクトリ内に格納されています (Windowsでは通常、"Documents and Settings/&lt;ユーザ名&gt;")。関連する項目はwebPortです。
</p>
<h3>起動成功</h3> <h3>起動成功</h3>
<p>
コンソールウィンドウからのサーバー起動が成功したら、新しいウィンドウが開き、 下記のように表示されます: コンソールウィンドウからのサーバー起動が成功したら、新しいウィンドウが開き、 下記のように表示されます:
<pre> <pre>
H2 Server running on port 9092 H2 Server running on port 9092
Webserver running on https://localhost:8082/ Webserver running on https://localhost:8082/
</pre> </pre>
ウィンドウ内をクリックしないで下さい; アプリケーションが遮断されてしまいます (Fast-Edit モードが有効の場合)。 ウィンドウ内をクリックしないで下さい; アプリケーションが遮断されてしまいます (Fast-Edit モードが有効の場合)。
</p>
<h3>ブラウザを使用してサーバーに接続</h3> <h3>ブラウザを使用してサーバーに接続</h3>
<p>
サーバーの接続に成功したら、webブラウザを使用してサーバーに接続することができます。 ブラウザにはJavaScript、フレーム、カスケードスタイルシート (css)のサポートが必要です。 もし同じコンピューターのブラウザでサーバーを起動したら、 http://localhost:8082 へアクセスしてください。他のコンピューターからアプリケーションに接続したい場合は、 サーバーのIPアドレスを用意することが必要です。 例: http://192.168.0.2:8082 サーバー側でSSLを使用したい場合は、URLをHTTPSから始めます。 サーバーの接続に成功したら、webブラウザを使用してサーバーに接続することができます。 ブラウザにはJavaScript、フレーム、カスケードスタイルシート (css)のサポートが必要です。 もし同じコンピューターのブラウザでサーバーを起動したら、 http://localhost:8082 へアクセスしてください。他のコンピューターからアプリケーションに接続したい場合は、 サーバーのIPアドレスを用意することが必要です。 例: http://192.168.0.2:8082 サーバー側でSSLを使用したい場合は、URLをHTTPSから始めます。
</p>
<h3>複数の同時セッション</h3> <h3>複数の同時セッション</h3>
<p>
複数の同時ブラウザセッションがサポートされています。 データベースオブジェクトはサーバーに属しているため、同時接続の数はサーバーアプリケーションの利用可能メモリによって制限されています。 複数の同時ブラウザセッションがサポートされています。 データベースオブジェクトはサーバーに属しているため、同時接続の数はサーバーアプリケーションの利用可能メモリによって制限されています。
</p>
<h3>アプリケーションプロパティ</h3> <h3>アプリケーションプロパティ</h3>
<p>
サーバーを起動するとローカルのホームディレクトリに .h2.server.properties と呼ばれるファイル構成が作成されます。Windowsのインストールでは、このファイルは will be in the directory C:\Documents and Settings\[ユーザ名]のディレクトリ内にあります。このファイルはアプリケーションのセッティングに含まれています。 サーバーを起動するとローカルのホームディレクトリに .h2.server.properties と呼ばれるファイル構成が作成されます。Windowsのインストールでは、このファイルは will be in the directory C:\Documents and Settings\[ユーザ名]のディレクトリ内にあります。このファイルはアプリケーションのセッティングに含まれています。
</p>
<h3>ログイン</h3> <h3>ログイン</h3>
<p> <p>
...@@ -123,7 +139,9 @@ Webserver running on https://localhost:8082/ ...@@ -123,7 +139,9 @@ Webserver running on https://localhost:8082/
</p> </p>
<h3>エラーメッセージ</h3> <h3>エラーメッセージ</h3>
<p>
エラーメッセージは赤で表示されます。 メッセージをクリックすることによって、例外の記録の表示、非表示を切り替えることができます。 エラーメッセージは赤で表示されます。 メッセージをクリックすることによって、例外の記録の表示、非表示を切り替えることができます。
</p>
<h3>データベースドライバの追加</h3> <h3>データベースドライバの追加</h3>
<p> <p>
...@@ -135,10 +153,14 @@ H2DRIVERSかCLASSPATHの環境変数に、ドライバのJarファイルの位 ...@@ -135,10 +153,14 @@ H2DRIVERSかCLASSPATHの環境変数に、ドライバのJarファイルの位
</p> </p>
<h3>アプリケーションを使用する</h3> <h3>アプリケーションを使用する</h3>
<p>
アプリケーションは3つのメインパネルを保持しています。上部のツールバー、左側のツリーとクエリ、右側の結果表示パネルです。 データベースオブジェクト (例; テーブル) は左側のパネルに一覧表示されます。クエリパネルにSQLコマンドを打ち、 'Run' をクリックします。 コマンドの結果は、コマンドのすぐ下に表示されます。 アプリケーションは3つのメインパネルを保持しています。上部のツールバー、左側のツリーとクエリ、右側の結果表示パネルです。 データベースオブジェクト (例; テーブル) は左側のパネルに一覧表示されます。クエリパネルにSQLコマンドを打ち、 'Run' をクリックします。 コマンドの結果は、コマンドのすぐ下に表示されます。
</p>
<h3>テーブル名、またはカラム名をインサートする</h3> <h3>テーブル名、またはカラム名をインサートする</h3>
<p>
テーブル名やカラム名は、ツリー内のテーブル名、カラム名をクリックすることによって スクリプトにインサートすることができます。クエリが空の時にテーブルをクリックすると、 'SELECT * FROM ...' も同様に追加されます。 クエリを入力している間、使用されているテーブルはツリー内で自動的に拡張されます。例えば、 'SELECT * FROM TEST T WHERE T.' と入力すると、ツリー内のTESTテーブルは自動的に拡張されます。 テーブル名やカラム名は、ツリー内のテーブル名、カラム名をクリックすることによって スクリプトにインサートすることができます。クエリが空の時にテーブルをクリックすると、 'SELECT * FROM ...' も同様に追加されます。 クエリを入力している間、使用されているテーブルはツリー内で自動的に拡張されます。例えば、 'SELECT * FROM TEST T WHERE T.' と入力すると、ツリー内のTESTテーブルは自動的に拡張されます。
</p>
<h3>切断とアプリケーションの終了</h3> <h3>切断とアプリケーションの終了</h3>
<p> <p>
...@@ -149,6 +171,7 @@ H2DRIVERSかCLASSPATHの環境変数に、ドライバのJarファイルの位 ...@@ -149,6 +171,7 @@ H2DRIVERSかCLASSPATHの環境変数に、ドライバのJarファイルの位
<br /><a name="connecting_using_jdbc"></a> <br /><a name="connecting_using_jdbc"></a>
<h2>JDBCを使用してデータベースに接続</h2> <h2>JDBCを使用してデータベースに接続</h2>
<p>
データベースに接続するためにJavaアプリケーションに最初に必要なことは、 データベースドライバをロードし、接続することです。簡単な方法は、次のコードを使用します: データベースに接続するためにJavaアプリケーションに最初に必要なことは、 データベースドライバをロードし、接続することです。簡単な方法は、次のコードを使用します:
<pre> <pre>
import java.sql.*; import java.sql.*;
...@@ -163,16 +186,22 @@ public class Test { ...@@ -163,16 +186,22 @@ public class Test {
} }
</pre> </pre>
このコードは最初にドライバをロードして (Class.forName())、 接続を開始します (DriverManager.getConnection())。 このドライバの名前は全てのケースにおいて "org.h2.Driver" です。 データベースに認識されるため、データベースのURLは常に jdbc:h2: から始まります。 getConnection() 内の2番目のパラメーターはユーザ名を指しています ('sa' はこの場合、システム管理者を表しています)。3番目のパラメーターはパスワードです。 このデータベースでは、ユーザ名は大文字と小文字を区別していませんが、パスワードは大文字と小文字を区別しています。 このコードは最初にドライバをロードして (Class.forName())、 接続を開始します (DriverManager.getConnection())。 このドライバの名前は全てのケースにおいて "org.h2.Driver" です。 データベースに認識されるため、データベースのURLは常に jdbc:h2: から始まります。 getConnection() 内の2番目のパラメーターはユーザ名を指しています ('sa' はこの場合、システム管理者を表しています)。3番目のパラメーターはパスワードです。 このデータベースでは、ユーザ名は大文字と小文字を区別していませんが、パスワードは大文字と小文字を区別しています。
</p>
<br /><a name="creating_new_databases"></a> <br /><a name="creating_new_databases"></a>
<h2>新しいデータベースを作成する</h2> <h2>新しいデータベースを作成する</h2>
<p>
初期設定では、データベースの指定されたURLがまだ存在しない場合、自動的に新しい (空の) データベースが作られます。 初期設定では、データベースの指定されたURLがまだ存在しない場合、自動的に新しい (空の) データベースが作られます。
</p>
<br /><a name="using_server"></a> <br /><a name="using_server"></a>
<h2>サーバーを使用する</h2> <h2>サーバーを使用する</h2>
<p>
H2は現在、3つのサーバーをサポートしています: Webサーバー、TCPサーバー、ODBCサーバーです。 これらのサーバーは異なった方法で起動します。 H2は現在、3つのサーバーをサポートしています: Webサーバー、TCPサーバー、ODBCサーバーです。 これらのサーバーは異なった方法で起動します。
</p>
<h3>コマンドラインから起動する</h3> <h3>コマンドラインから起動する</h3>
<p>
初期設定でコマンドラインからサーバーを起動させるには、次のように実行します。 初期設定でコマンドラインからサーバーを起動させるには、次のように実行します。
<pre> <pre>
java org.h2.tools.Server java org.h2.tools.Server
...@@ -182,16 +211,22 @@ java org.h2.tools.Server ...@@ -182,16 +211,22 @@ java org.h2.tools.Server
java org.h2.tools.Server -? java org.h2.tools.Server -?
</pre> </pre>
異なったポートの使用が可能なオプションや、サーバーの一部を起動、終了させるオプションなどがあります。 詳細はサーバーツールのAPIドキュメントをご覧下さい。 異なったポートの使用が可能なオプションや、サーバーの一部を起動、終了させるオプションなどがあります。 詳細はサーバーツールのAPIドキュメントをご覧下さい。
</p>
<h3>Connecting to the TCP Server</h3> <h3>Connecting to the TCP Server</h3>
<p>
To remotly connect to a database using the TCP server, use the following driver and database URL: To remotly connect to a database using the TCP server, use the following driver and database URL:
</p>
<ul> <ul>
<li>JDBC driver class: org.h2.Driver <li>JDBC driver class: org.h2.Driver
</li><li>Database URL: jdbc:h2:tcp://localhost/~/test </li><li>Database URL: jdbc:h2:tcp://localhost/~/test
</li></ul> </li></ul>
<p>
For details about the database URL, see also in Features. For details about the database URL, see also in Features.
</p>
<h3>アプリケーション内で起動する</h3> <h3>アプリケーション内で起動する</h3>
<p>
アプリケーション内からサーバーを起動、終了することも可能です。 以下はサンプルコードです: アプリケーション内からサーバーを起動、終了することも可能です。 以下はサンプルコードです:
<pre> <pre>
import org.h2.tools.Server; import org.h2.tools.Server;
...@@ -202,8 +237,10 @@ Server server = Server.createTcpServer(args).start(); ...@@ -202,8 +237,10 @@ Server server = Server.createTcpServer(args).start();
// stop the TCP Server // stop the TCP Server
server.stop(); server.stop();
</pre> </pre>
</p>
<h3>他の過程からTCPサーバーを終了する</h3> <h3>他の過程からTCPサーバーを終了する</h3>
<p>
TCPサーバーは他の過程から終了することができます。 コマンドラインからサーバーを終了するには、次のように実行します: TCPサーバーは他の過程から終了することができます。 コマンドラインからサーバーを終了するには、次のように実行します:
<pre> <pre>
java org.h2.tools.Server -tcpShutdown tcp://localhost:9092 java org.h2.tools.Server -tcpShutdown tcp://localhost:9092
...@@ -213,9 +250,12 @@ java org.h2.tools.Server -tcpShutdown tcp://localhost:9092 ...@@ -213,9 +250,12 @@ java org.h2.tools.Server -tcpShutdown tcp://localhost:9092
org.h2.tools.Server.shutdownTcpServer("tcp://localhost:9094"); org.h2.tools.Server.shutdownTcpServer("tcp://localhost:9094");
</pre> </pre>
この機能はサーバー上の System.exit を呼んでいます。この機能は、データベースが次回起動された時のリカバリーを回避するため、 データベースへの全ての接続が切断された後に呼ばれます。リモートサーバーを終了するには、サーバー上でリモート接続が可能である必要があります。 この機能はサーバー上の System.exit を呼んでいます。この機能は、データベースが次回起動された時のリカバリーを回避するため、 データベースへの全ての接続が切断された後に呼ばれます。リモートサーバーを終了するには、サーバー上でリモート接続が可能である必要があります。
</p>
<h3>サーバーの制限</h3> <h3>サーバーの制限</h3>
<p>
現在、サーバーやクラスターモードを使用する時にいくつかの制限があります: 現在、サーバーやクラスターモードを使用する時にいくつかの制限があります:
</p>
<ul> <ul>
<li>Statement.cancel() はエンベッドモードのみサポートされています。接続はサーバー、またはクラスターモードで1度にひとつのオペレーションで実行され、 このオペレーションが終了するまで接続は遮断されます。 <li>Statement.cancel() はエンベッドモードのみサポートされています。接続はサーバー、またはクラスターモードで1度にひとつのオペレーションで実行され、 このオペレーションが終了するまで接続は遮断されます。
</li><li>CLOBとBLOBはストリームとしてではなく、ひとつの断片としてサーバーに送信されます。これは、サーバーやクラスターモードを使用している時、 CLOBとBLOBはメモリーに適合している必要があるということを意味しています。 </li><li>CLOBとBLOBはストリームとしてではなく、ひとつの断片としてサーバーに送信されます。これは、サーバーやクラスターモードを使用している時、 CLOBとBLOBはメモリーに適合している必要があるということを意味しています。
...@@ -223,47 +263,63 @@ org.h2.tools.Server.shutdownTcpServer("tcp://localhost:9094"); ...@@ -223,47 +263,63 @@ org.h2.tools.Server.shutdownTcpServer("tcp://localhost:9094");
<br /><a name="using_hibernate"></a> <br /><a name="using_hibernate"></a>
<h2>Hibernateを使用する</h2> <h2>Hibernateを使用する</h2>
<p>
このデータベースはHibernate version 3.1 と以降の新しいバージョンをサポートしています。 HSQLDB Dialect、または H2 Dialectは src/tools/org/h2/tools/hibernate/H2Dialect.txt ファイル内で使用可能です。 H2 dialectは Hibernateのより新しいバージョンに含まれています。H2 dialectが含まれていないバージョンでは、 src\org\hibernate\dialect (Hibernate 3.1の場合) フォルダ内のファイルをコピーし、 H2Dialect.java にファイル名を変更し、 Hibernateを再びコンパイルします。 このデータベースはHibernate version 3.1 と以降の新しいバージョンをサポートしています。 HSQLDB Dialect、または H2 Dialectは src/tools/org/h2/tools/hibernate/H2Dialect.txt ファイル内で使用可能です。 H2 dialectは Hibernateのより新しいバージョンに含まれています。H2 dialectが含まれていないバージョンでは、 src\org\hibernate\dialect (Hibernate 3.1の場合) フォルダ内のファイルをコピーし、 H2Dialect.java にファイル名を変更し、 Hibernateを再びコンパイルします。
</p>
<br /><a name="web_applications"></a> <br /><a name="web_applications"></a>
<h2>Webアプリケーションでデータベースを使用する</h2> <h2>Webアプリケーションでデータベースを使用する</h2>
<p>
Webアプリケーション内からデータベースに接続するには様々な方法があります。 以下はTomcatかJBossを使用の場合のいくつかの例です。 Webアプリケーション内からデータベースに接続するには様々な方法があります。 以下はTomcatかJBossを使用の場合のいくつかの例です。
</p>
<h3>エンベッドモード</h3> <h3>エンベッドモード</h3>
<p>
(現在)最も簡単なソリューションはエンベッドモードでデータベースを使用することです。 それは、アプリケーションが起動する時や (良いソリューションは Servletリスナーを使用します。下記参照)、 セッションが起動する時、アプリケーションにおける接続が開始するということを意味します。 データベースは、セッションやアプリケーションが同じ過程で実行している限り、 多様なセッションやアプリケーションから同時に接続されることが可能です。 多くのServletコンテナは (例; Tomcat) ただひとつのプロセスで利用されるので、問題はありません。 (Tomcatをクラスターモードで起動している場合を除いて)。 Tomcatはマルチスレッドとマルチクラスローダーを使用しています。 もし複数のアプリケーションが同じデータベースに同時にアクセスする場合、データベースjarをshared/lib、またはserver/libディレクトリに置く必要があります。 webアプリケーションが起動した時にデータベースを開き、webアプリケーションが終了した時にデータベースを閉じるのが良い方法です。 もし複数のアプリケーションを使用する場合、そのうちひとつのアプリケーションをこのように動作することが必要です。 アプリケーションでは、セッションごとにひとつの接続を使うか、リクエスト(アクション)ごとにひとつの接続を使うという概念があります。 これらの接続はできる限り、使用後に終了させます(しかし、終了させなくても悪くはありません)。 (現在)最も簡単なソリューションはエンベッドモードでデータベースを使用することです。 それは、アプリケーションが起動する時や (良いソリューションは Servletリスナーを使用します。下記参照)、 セッションが起動する時、アプリケーションにおける接続が開始するということを意味します。 データベースは、セッションやアプリケーションが同じ過程で実行している限り、 多様なセッションやアプリケーションから同時に接続されることが可能です。 多くのServletコンテナは (例; Tomcat) ただひとつのプロセスで利用されるので、問題はありません。 (Tomcatをクラスターモードで起動している場合を除いて)。 Tomcatはマルチスレッドとマルチクラスローダーを使用しています。 もし複数のアプリケーションが同じデータベースに同時にアクセスする場合、データベースjarをshared/lib、またはserver/libディレクトリに置く必要があります。 webアプリケーションが起動した時にデータベースを開き、webアプリケーションが終了した時にデータベースを閉じるのが良い方法です。 もし複数のアプリケーションを使用する場合、そのうちひとつのアプリケーションをこのように動作することが必要です。 アプリケーションでは、セッションごとにひとつの接続を使うか、リクエスト(アクション)ごとにひとつの接続を使うという概念があります。 これらの接続はできる限り、使用後に終了させます(しかし、終了させなくても悪くはありません)。
</p>
<h3>サーバーモード</h3> <h3>サーバーモード</h3>
<p>
サーバーモードは類似していますが、他のプロセスでサーバーを起動させることを許可しています。 サーバーモードは類似していますが、他のプロセスでサーバーを起動させることを許可しています。
</p>
<h3>データベースの起動と終了にServletリスナーを使用する</h3> <h3>データベースの起動と終了にServletリスナーを使用する</h3>
<p>
以下を web.xmlファイルに追記して下さい。 (context-paramとfilterの間): 以下を web.xmlファイルに追記して下さい。 (context-paramとfilterの間):
<pre> <pre>
&lt;listener> &lt;listener>
&lt;listener-class>org.h2.server.web.DbStarter&lt;/listener-class> &lt;listener-class>org.h2.server.web.DbStarter&lt;/listener-class>
&lt;/listener> &lt;/listener>
</pre> </pre>
For details on how to access the database, see the code DbStarter.java For details on how to access the database, see the code DbStarter.java
</p>
<br /><a name="csv"></a> <br /><a name="csv"></a>
<h2>CSV (Comma Separated Values) サポート</h2> <h2>CSV (Comma Separated Values) サポート</h2>
<p>
データベースにCSVREADとCSVWRITEの関数を使用することで、 CSVファイルサポートを使用することができ、スタンドアロンツールとしてデータベースの外でCSVライブラリを使用することができます。 データベースにCSVREADとCSVWRITEの関数を使用することで、 CSVファイルサポートを使用することができ、スタンドアロンツールとしてデータベースの外でCSVライブラリを使用することができます。
</p>
<h3>データベース内からCSVファイルに書き込む</h3> <h3>データベース内からCSVファイルに書き込む</h3>
<p>
クエリからCSVファイルを作成するのに、組込み関数 CSVWRITEを使用することができます。例: クエリからCSVファイルを作成するのに、組込み関数 CSVWRITEを使用することができます。例:
<pre> <pre>
CREATE TABLE TEST(ID INT, NAME VARCHAR); CREATE TABLE TEST(ID INT, NAME VARCHAR);
INSERT INTO TEST VALUES(1, 'Hello'), (2, 'World'); INSERT INTO TEST VALUES(1, 'Hello'), (2, 'World');
CALL CSVWRITE('test.csv', 'SELECT * FROM TEST'); CALL CSVWRITE('test.csv', 'SELECT * FROM TEST');
</pre> </pre>
</p>
<h3>データベース内からCSVファイルを読み込む</h3> <h3>データベース内からCSVファイルを読み込む</h3>
<p>
CSVREAD関数を使用してCSVファイルを読み込むことができます。 例: CSVREAD関数を使用してCSVファイルを読み込むことができます。 例:
<pre> <pre>
SELECT * FROM CSVREAD('test.csv'); SELECT * FROM CSVREAD('test.csv');
</pre> </pre>
</p>
<h3>JavaアプリケーションからCSVファイルに書き込む</h3> <h3>JavaアプリケーションからCSVファイルに書き込む</h3>
<p>
データベースを全く使用しなくても、JavaアプリケーションでCSVツールを使用することができます。 例: データベースを全く使用しなくても、JavaアプリケーションでCSVツールを使用することができます。 例:
<pre> <pre>
SimpleResultSet rs = new SimpleResultSet(); SimpleResultSet rs = new SimpleResultSet();
...@@ -274,8 +330,10 @@ rs.addRow(new String[]{"Bob Meier", "bob.meier@abcde.abc", "+41123456789"}); ...@@ -274,8 +330,10 @@ rs.addRow(new String[]{"Bob Meier", "bob.meier@abcde.abc", "+41123456789"});
rs.addRow(new String[]{"John Jones", "john.jones@abcde.abc", "+41976543210"}); rs.addRow(new String[]{"John Jones", "john.jones@abcde.abc", "+41976543210"});
Csv.write("test.csv", rs, null); Csv.write("test.csv", rs, null);
</pre> </pre>
</p>
<h3>JavaアプリケーションからCSVファイルを読み込む</h3> <h3>JavaアプリケーションからCSVファイルを読み込む</h3>
<p>
データベースを開かなくてもCSVファイルを読み込むことができます。 例: データベースを開かなくてもCSVファイルを読み込むことができます。 例:
<pre> <pre>
ResultSet rs = Csv.read("test.csv", null, null); ResultSet rs = Csv.read("test.csv", null, null);
...@@ -288,28 +346,36 @@ while(rs.next()) { ...@@ -288,28 +346,36 @@ while(rs.next()) {
} }
rs.close(); rs.close();
</pre> </pre>
</p>
<br /><a name="upgrade_backup_restore"></a> <br /><a name="upgrade_backup_restore"></a>
<h2>アップグレード、バックアップ、修復</h2> <h2>アップグレード、バックアップ、修復</h2>
<h3>データベースのアップグレー</h3> <h3>データベースのアップグレー</h3>
<p>
あるバージョンのデータベースエンジンを次のバージョンにアップグレードする際の推奨する方法は、 古いエンジンを使って(SQLスクリプトのフォームでの)データベースのバックアップを作成し、新しいエンジンを使ってSQLスクリプトを実行します。 あるバージョンのデータベースエンジンを次のバージョンにアップグレードする際の推奨する方法は、 古いエンジンを使って(SQLスクリプトのフォームでの)データベースのバックアップを作成し、新しいエンジンを使ってSQLスクリプトを実行します。
</p>
<h3>バックアップ</h3> <h3>バックアップ</h3>
<p>
異なった方法のデータベースのバックアップがあります。例えば、データベースファイルをコピーすることが可能です。 しかしながら、この方法はデータベースが使用されている間は推奨しません。データベースは人が判読しやすく、極めて大きいというわけではありません。 データベースバックアップの推奨する方法は、圧縮したSQLスクリプトを作成することです。この方法は、バックアップツールを使用することで可能です: 異なった方法のデータベースのバックアップがあります。例えば、データベースファイルをコピーすることが可能です。 しかしながら、この方法はデータベースが使用されている間は推奨しません。データベースは人が判読しやすく、極めて大きいというわけではありません。 データベースバックアップの推奨する方法は、圧縮したSQLスクリプトを作成することです。この方法は、バックアップツールを使用することで可能です:
<pre> <pre>
java org.h2.tools.Script -url jdbc:h2:~/test -user sa -script test.zip -options compression zip java org.h2.tools.Script -url jdbc:h2:~/test -user sa -script test.zip -options compression zip
</pre> </pre>
オプションについての情報は、SQLコマンドスクリプトをご覧下さい。バックアップは遠隔で行えますが、ファイルはサーバー側に作られます。 サーバーからファイルを取るのに、ビルトインFTPサーバーを使用することができます。データベースのバックアップを作るのに、SQLコマンドスクリプトを 使用することもできます。 オプションについての情報は、SQLコマンドスクリプトをご覧下さい。バックアップは遠隔で行えますが、ファイルはサーバー側に作られます。 サーバーからファイルを取るのに、ビルトインFTPサーバーを使用することができます。データベースのバックアップを作るのに、SQLコマンドスクリプトを 使用することもできます。
</p>
<h3>修復</h3> <h3>修復</h3>
<p>
SQLスクリプトファイルからデータベースを修復するには、RunScriptツールを使用する必要があります: SQLスクリプトファイルからデータベースを修復するには、RunScriptツールを使用する必要があります:
<pre> <pre>
java org.h2.tools.RunScript -url jdbc:h2:~/test -user sa -script test.zip -options compression zip java org.h2.tools.RunScript -url jdbc:h2:~/test -user sa -script test.zip -options compression zip
</pre> </pre>
オプションについての情報は、SQLコマンド RUNSCRIPTをご覧下さい。修復は遠隔で行えますが、サーバー側にファイルが存在する必要があります。 サーバーからファイルをコピーするのに、ビルトインFTPサーバーを使用することができます。SQLスクリプトを実行するために、 SQLコマンド RUNSCRIPTを使用することができます。SQLスクリプトファイルには、RUNSCRIPTコマンドのフォーム内に他のスクリプトファイルのリファレンスが含まれています。 しかしながら、サーバーモードを使用している時、リファレンススクリプトファイルはサーバー側で利用可能であることが必要です。 オプションについての情報は、SQLコマンド RUNSCRIPTをご覧下さい。修復は遠隔で行えますが、サーバー側にファイルが存在する必要があります。 サーバーからファイルをコピーするのに、ビルトインFTPサーバーを使用することができます。SQLスクリプトを実行するために、 SQLコマンド RUNSCRIPTを使用することができます。SQLスクリプトファイルには、RUNSCRIPTコマンドのフォーム内に他のスクリプトファイルのリファレンスが含まれています。 しかしながら、サーバーモードを使用している時、リファレンススクリプトファイルはサーバー側で利用可能であることが必要です。
</p>
<h3>Online Backup</h3> <h3>Online Backup</h3>
<p>
The BACKUP SQL statement and the Backup tool both create a zip file The BACKUP SQL statement and the Backup tool both create a zip file
with all database files. However, the contents of this file are not human readable. with all database files. However, the contents of this file are not human readable.
Other than the SCRIPT statement, the BACKUP statement does not lock the Other than the SCRIPT statement, the BACKUP statement does not lock the
...@@ -320,11 +386,13 @@ BACKUP TO 'backup.zip' ...@@ -320,11 +386,13 @@ BACKUP TO 'backup.zip'
</pre> </pre>
The Backup tool (org.h2.tools.Backup) can not be used to create a online backup; The Backup tool (org.h2.tools.Backup) can not be used to create a online backup;
the database must not be in use while running this program. the database must not be in use while running this program.
</p>
<br /><a name="open_office"></a> <br /><a name="open_office"></a>
<h2>OpenOffice Baseを使用する</h2> <h2>OpenOffice Baseを使用する</h2>
<p>
OpenOffice.org Base はJDBC API上のデータベースアクセスをサポートしています。 OpenOffice Baseを使ってH2データベースに接続するためには、最初にOpenOfficeにJDBCドライバを追加する必要があります。H2データベースに接続する手順: OpenOffice.org Base はJDBC API上のデータベースアクセスをサポートしています。 OpenOffice Baseを使ってH2データベースに接続するためには、最初にOpenOfficeにJDBCドライバを追加する必要があります。H2データベースに接続する手順:
</p>
<ul> <ul>
<li>オートスタートを含め、OpenOfficeを終了する <li>オートスタートを含め、OpenOfficeを終了する
</li><li>h2.jar ファイルを &lt;OpenOffice&gt;\program\classes ディレクトリ内にコピーする </li><li>h2.jar ファイルを &lt;OpenOffice&gt;\program\classes ディレクトリ内にコピーする
...@@ -333,21 +401,22 @@ OpenOffice.org Base はJDBC API上のデータベースアクセスをサポー ...@@ -333,21 +401,22 @@ OpenOffice.org Base はJDBC API上のデータベースアクセスをサポー
</li><li>データソースURLの例: jdbc:h2:c:/temp/test </li><li>データソースURLの例: jdbc:h2:c:/temp/test
</li><li>JDBCドライバクラス: org.h2.Driver </li><li>JDBCドライバクラス: org.h2.Driver
</li></ul> </li></ul>
<p>
これで、C:/temp ディレクトリ内に格納されているデータベースにアクセス可能です。 これで、C:/temp ディレクトリ内に格納されているデータベースにアクセス可能です。
</p>
<br /><a name="web_start"></a> <br /><a name="web_start"></a>
<h2>Java Web Start / JNLP</h2> <h2>Java Web Start / JNLP</h2>
<p>
When using Java Web Start / JNLP (Java Network Launch Protocol), permissions tags must be set in the .jnlp file, When using Java Web Start / JNLP (Java Network Launch Protocol), permissions tags must be set in the .jnlp file,
and the application .jar file must be signed. Otherwise, when trying to write to the file system, the following and the application .jar file must be signed. Otherwise, when trying to write to the file system, the following
exception will occur: java.security.AccessControlException: access denied (java.io.FilePermission ... read). exception will occur: java.security.AccessControlException: access denied (java.io.FilePermission ... read).
Example permission tags: Example permission tags:
<pre> <pre>
&lt;security> &lt;security>
&lt;all-permissions/> &lt;all-permissions/>
&lt;/security> &lt;/security>
</pre> </pre>
</p>
</div></td></tr></table></body></html> </div></td></tr></table></body></html>
\ No newline at end of file
...@@ -211,6 +211,7 @@ public class Constants { ...@@ -211,6 +211,7 @@ public class Constants {
public static final int DEFAULT_MAX_MEMORY_UNDO = getIntSetting("h2.defaultMaxMemoryUndo", 50000); public static final int DEFAULT_MAX_MEMORY_UNDO = getIntSetting("h2.defaultMaxMemoryUndo", 50000);
public static final boolean OPTIMIZE_NOT = getBooleanSetting("h2.optimizeNot", true); public static final boolean OPTIMIZE_NOT = getBooleanSetting("h2.optimizeNot", true);
public static final boolean OPTIMIZE_2_EQUALS = getBooleanSetting("h2.optimizeTwoEquals", true); public static final boolean OPTIMIZE_2_EQUALS = getBooleanSetting("h2.optimizeTwoEquals", true);
public static final int DEFAULT_LOCK_MODE = getIntSetting("h2.defaultLockMode", LOCK_MODE_READ_COMMITTED);
public static void setBaseDir(String dir) { public static void setBaseDir(String dir) {
if(!dir.endsWith("/")) { if(!dir.endsWith("/")) {
......
...@@ -116,7 +116,7 @@ public class Database implements DataHandler { ...@@ -116,7 +116,7 @@ public class Database implements DataHandler {
private FileStore emergencyReserve; private FileStore emergencyReserve;
private int maxMemoryRows = Constants.DEFAULT_MAX_MEMORY_ROWS; private int maxMemoryRows = Constants.DEFAULT_MAX_MEMORY_ROWS;
private int maxMemoryUndo = Constants.DEFAULT_MAX_MEMORY_UNDO; private int maxMemoryUndo = Constants.DEFAULT_MAX_MEMORY_UNDO;
private int lockMode = Constants.LOCK_MODE_TABLE; private int lockMode = Constants.DEFAULT_LOCK_MODE;
private boolean logIndexChanges; private boolean logIndexChanges;
private int logLevel = 1; private int logLevel = 1;
private int cacheSize; private int cacheSize;
......
...@@ -1412,13 +1412,18 @@ public class Function extends Expression implements FunctionCall { ...@@ -1412,13 +1412,18 @@ public class Function extends Expression implements FunctionCall {
buff.append(info.name); buff.append(info.name);
buff.append('('); buff.append('(');
switch(info.type) { switch(info.type) {
case CAST: case CAST: {
case CONVERT: {
buff.append(args[0].getSQL()); buff.append(args[0].getSQL());
buff.append(" AS "); buff.append(" AS ");
buff.append(new Column(null, dataType, precision, scale).getCreateSQL()); buff.append(new Column(null, dataType, precision, scale).getCreateSQL());
break; break;
} }
case CONVERT: {
buff.append(args[0].getSQL());
buff.append(",");
buff.append(new Column(null, dataType, precision, scale).getCreateSQL());
break;
}
case EXTRACT: { case EXTRACT: {
ValueString v = (ValueString)((ValueExpression)args[0]).getValue(null); ValueString v = (ValueString)((ValueExpression)args[0]).getValue(null);
buff.append(v.getString()); buff.append(v.getString());
......
...@@ -63,8 +63,8 @@ ...@@ -63,8 +63,8 @@
90040=F\u00FCr diese Operation werden Administrator-Rechte ben\u00F6tigt 90040=F\u00FCr diese Operation werden Administrator-Rechte ben\u00F6tigt
90041=Trigger {0} besteht bereits 90041=Trigger {0} besteht bereits
90042=Trigger {0} nicht gefunden 90042=Trigger {0} nicht gefunden
90043=Fehler beim Erzeugen des Triggers {0}, Klasse {1} 90043=Fehler beim Erzeugen des Triggers {0}, Klasse {1}; siehe Ursache f\u00FCr Details
90044=Fehler beim Ausf\u00FChren des Triggers {0}, Klasse {1} 90044=Fehler beim Ausf\u00FChren des Triggers {0}, Klasse {1}; siehe Ursache f\u00FCr Details
90045=Bedingung {0} besteht bereits 90045=Bedingung {0} besteht bereits
90046=URL Format Fehler; erwartet {0}, erhalten {1} 90046=URL Format Fehler; erwartet {0}, erhalten {1}
90047=Falsche Version, Treiber Version ist {0}, Server Version ist {1} 90047=Falsche Version, Treiber Version ist {0}, Server Version ist {1}
......
...@@ -63,8 +63,8 @@ ...@@ -63,8 +63,8 @@
90040=Admin rights are required for this operation 90040=Admin rights are required for this operation
90041=Trigger {0} already exists 90041=Trigger {0} already exists
90042=Trigger {0} not found 90042=Trigger {0} not found
90043=Error creating trigger {0} object, class {1} 90043=Error creating or initializing trigger {0} object, class {1}; see root cause for details
90044=Error executing trigger {0}, class {1} 90044=Error executing trigger {0}, class {1}; see root cause for details
90045=Constraint {0} already exists 90045=Constraint {0} already exists
90046=URL format error; must be {0} but is {1} 90046=URL format error; must be {0} but is {1}
90047=Version mismatch, driver version is {0} but server version is {1} 90047=Version mismatch, driver version is {0} but server version is {1}
......
...@@ -63,8 +63,8 @@ ...@@ -63,8 +63,8 @@
90040=Uprawnienia administratora sa wymagane do wykonania tej operacji 90040=Uprawnienia administratora sa wymagane do wykonania tej operacji
90041=Wyzwalacz {0} juz istnieje 90041=Wyzwalacz {0} juz istnieje
90042=Wyzwalacz {0} nie istnieje 90042=Wyzwalacz {0} nie istnieje
90043=Blad tworzenia wyzwalacza, obiekt {0}, klasa {1} 90043=\#Blad tworzenia wyzwalacza, obiekt {0}, klasa {1}
90044=Blad wykonania wyzwalacza, obiekt {0}, klasa {1} 90044=\#Blad wykonania wyzwalacza, obiekt {0}, klasa {1}
90045=Ograniczenie {0} juz istnieje 90045=Ograniczenie {0} juz istnieje
90046=Bledny format URL; powinno byc {0} a jest {1} 90046=Bledny format URL; powinno byc {0} a jest {1}
90047=Niezgodna wersja sterownika, aktualna werjsa to {0} a wersja serwera to {1} 90047=Niezgodna wersja sterownika, aktualna werjsa to {0} a wersja serwera to {1}
...@@ -149,6 +149,7 @@ ...@@ -149,6 +149,7 @@
90126=Baza danych nie jest trwala 90126=Baza danych nie jest trwala
90127=\#The result set is not updatable. The query must select all columns from a unique key. Only one table may be selected. 90127=\#The result set is not updatable. The query must select all columns from a unique key. Only one table may be selected.
90128=\#The result set is not scrollable and can not be reset. You may need to use conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY). 90128=\#The result set is not scrollable and can not be reset. You may need to use conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY).
90129=\#Transaction {0} not found
HY000=Blad ogolny\: {0} HY000=Blad ogolny\: {0}
HY004=Nieznany typ danyche\: {0} HY004=Nieznany typ danyche\: {0}
HYC00=Cecha nie jest wspierana HYC00=Cecha nie jest wspierana
......
...@@ -94,53 +94,16 @@ java -Xmx512m -Xrunhprof:cpu=samples,depth=8 org.h2.tools.RunScript -url jdbc:h2 ...@@ -94,53 +94,16 @@ java -Xmx512m -Xrunhprof:cpu=samples,depth=8 org.h2.tools.RunScript -url jdbc:h2
/* /*
Add version number. Install directory: h2-1.0, jar file: h2-1.0.jar strict xhtml (license,...)
make docs translatable
Class.forName("org.h2.Driver");
DeleteDbFiles.execute("~", null, true);
Connection conn1 = DriverManager.getConnection("jdbc:h2:~/test");
Statement s1 = conn1.createStatement();
s1.execute("create table test(id int)");
conn1.setAutoCommit(false);
s1.execute("delete from test");
s1.execute("PREPARE COMMIT TX_8");
s1.execute("COMMIT TRANSACTION TX_8");
Connection conn2 = DriverManager.getConnection("jdbc:h2:~/test");
conn2.createStatement().execute("select * from test");
create table test(id int);
set autocommit off;
insert into test values(1);
prepare commit tx1;
commit transaction tx1;
rollback;
select * from test;
drop table test;
call N'@name';
pg_version is in public instead of pg_catalog
copyright to include 2007
search for japanese: works, but is it ok? search for japanese: works, but is it ok?
can not use google to translate h2 homepage?
pdf: first page looks empty (because the top part is empty) - title on the top? pdf: first page looks empty (because the top part is empty) - title on the top?
pdf / openoffice: pictures don't work? pdf / openoffice: pictures don't work?
test odbc again a few times (debug catalog creation)
extend tests that simulate power off extend tests that simulate power off
CREATE TABLE first (id IDENTITY, value INT); Openfire server uses this script to setup a user permissions
CREATE TABLE second (id IDENTITY, value INT);
CREATE TRIGGER T BEFORE INSERT ON first CALL X;
INSERT INTO first VALUES(1,2);
...trigger calls INSERT INTO second VALUES(3, 4); before the first INSERT
CALL IDENTITY();
Openfire server uses this script to setup a user permissions
on the fresh-installed server. The database is [current] HSQLDB : on the fresh-installed server. The database is [current] HSQLDB :
CREATE SCHEMA PUBLIC AUTHORIZATION DBA CREATE SCHEMA PUBLIC AUTHORIZATION DBA
CREATE USER SA PASSWORD "" CREATE USER SA PASSWORD ""
...@@ -154,8 +117,6 @@ move Comparison to Other Database Engines > Comparison ...@@ -154,8 +117,6 @@ move Comparison to Other Database Engines > Comparison
move Products that Work with H2 > Comparison move Products that Work with H2 > Comparison
move Performance Tuning > Advanced Topics move Performance Tuning > Advanced Topics
set read-committed as the default
storages should be an int hash map storages should be an int hash map
testHalt testHalt
...@@ -197,10 +158,6 @@ Automate real power off tests ...@@ -197,10 +158,6 @@ Automate real power off tests
Negative dictionary: Negative dictionary:
Please note that Please note that
support translated exceptions (translated, then english at the end, for Hibernate compatibility)
make static member variables final (this helps find forgotten initializers)
Merge more from diff.zip (Pavel Ganelin) Merge more from diff.zip (Pavel Ganelin)
Integrate patches from Pavel Ganelin: www.dullesopen.com/software/h2-database-03-04-07-mod.src.zip Integrate patches from Pavel Ganelin: www.dullesopen.com/software/h2-database-03-04-07-mod.src.zip
...@@ -217,8 +174,6 @@ http://javolution.org/ ...@@ -217,8 +174,6 @@ http://javolution.org/
http://joda-time.sourceforge.net/ http://joda-time.sourceforge.net/
http://ibatis.apache.org/ http://ibatis.apache.org/
strict xhtml (license,...)
Document org.h2.samples.MixedMode Document org.h2.samples.MixedMode
http://www.igniterealtime.org/projects/openfire/index.jsp http://www.igniterealtime.org/projects/openfire/index.jsp
...@@ -242,8 +197,12 @@ document SET SEARCH_PATH, BEGIN, EXECUTE, $ parameters ...@@ -242,8 +197,12 @@ document SET SEARCH_PATH, BEGIN, EXECUTE, $ parameters
Complete Javadocs for Messages and add to docs Complete Javadocs for Messages and add to docs
Add version number. Install directory: h2-1.0, jar file: h2-1.0.jar
write tests using the PostgreSQL JDBC driver write tests using the PostgreSQL JDBC driver
JDK 1.6: Deskop.isDesktopSupported, browse(URI uri)
*/ */
/* /*
......
select * from (select x from dual union select convert(x, int) from dual) where x=0;
create table test(id int); create table test(id int);
insert into scriptSimple.public.test(id) values(1), (2); insert into scriptSimple.public.test(id) values(1), (2);
update test t set t.id=t.id+1; update test t set t.id=t.id+1;
......
...@@ -9,47 +9,44 @@ import java.io.ByteArrayInputStream; ...@@ -9,47 +9,44 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.LineNumberReader; import java.io.LineNumberReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.io.Writer;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.Properties; import java.util.Properties;
import java.util.Stack;
import org.h2.tools.doc.XMLParser; import org.h2.tools.doc.XMLParser;
import org.h2.util.FileUtils; import org.h2.util.FileUtils;
import org.h2.util.IOUtils; import org.h2.util.IOUtils;
import org.h2.util.SortedProperties;
import org.h2.util.StringUtils;
public class PrepareTranslation { public class PrepareTranslation {
private static final String MAIN_LANGUAGE = "en"; private static final String MAIN_LANGUAGE = "en";
private static final String DELETED_PREFIX = "~"; private static final String DELETED_PREFIX = "~";
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
int todoSwitchOn; String baseDir = "src/tools/org/h2/tools/i18n";
// String baseDir = "src/tools/org/h2/tools/i18n"; String path;
// String path; path = "src/main/org/h2/res";
// path = "src/main/org/h2/res"; prepare(baseDir, path);
// prepare(baseDir, path); path = "src/main/org/h2/server/web/res";
// path = "src/main/org/h2/server/web/res"; prepare(baseDir, path);
// prepare(baseDir, path);
int todoAllowTranslateHtmlFiles; int todoAllowTranslateHtmlFiles;
extract("src/docsrc/html"); // extract("src/docsrc/html");
} }
private static void extract(String dir) throws Exception { private static void extract(String dir) throws Exception {
File[] list = new File(dir).listFiles(); File[] list = new File(dir).listFiles();
HashSet set = new HashSet(); HashSet set = new HashSet();
for(int i=0; i<list.length; i++) { for (int i = 0; i < list.length; i++) {
File f = list[i]; File f = list[i];
String name = f.getName(); String name = f.getName();
if(!name.endsWith(".html")) { if (!name.endsWith(".html")) {
continue; continue;
} }
name = name.substring(0, name.length() - 5); name = name.substring(0, name.length() - 5);
...@@ -58,78 +55,117 @@ public class PrepareTranslation { ...@@ -58,78 +55,117 @@ public class PrepareTranslation {
} }
private static boolean isText(String s) { private static boolean isText(String s) {
if(s.length() < 2) { if (s.length() < 2) {
return false; return false;
} }
for(int i=0; i<s.length(); i++) { for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i); char c = s.charAt(i);
if(!Character.isDigit(c) && c != '.' && c != '-' && c != '+') { if (!Character.isDigit(c) && c != '.' && c != '-' && c != '+') {
return true; return true;
} }
} }
return false; return false;
} }
private static void extract(HashSet already, String documentName, File f) throws Exception { private static void extract(HashSet already, String documentName, File f)
String xml = IOUtils.readStringAndClose(new InputStreamReader(new FileInputStream(f), "UTF-8"), -1); throws Exception {
// Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(f.getName()), "UTF-8")); String xml = IOUtils.readStringAndClose(new InputStreamReader(
new FileInputStream(f), "UTF-8"), -1);
int id = 0;
Properties prop = new SortedProperties();
XMLParser parser = new XMLParser(xml); XMLParser parser = new XMLParser(xml);
StringBuffer buff = new StringBuffer(); StringBuffer buff = new StringBuffer();
boolean translate = true; Stack stack = new Stack();
String tag = ""; String tag = "";
for(int i=0;;) { boolean ignoreEnd = false;
while (true) {
int event = parser.next(); int event = parser.next();
String s = parser.getToken(); if (event == XMLParser.END_DOCUMENT) {
// writer.write(s);
if(event == XMLParser.END_DOCUMENT) {
break; break;
} else if(event == XMLParser.CHARACTERS) { } else if (event == XMLParser.CHARACTERS) {
String text = parser.getText(); String text = parser.getText().trim();
if(translate) { if (text.length() == 0) {
if("p".equals(tag) || "li".equals(tag) || "a".equals(tag) || continue;
"td".equals(tag) || "th".equals(tag) || "h1".equals(tag) || } else if ("p".equals(tag) || "li".equals(tag)
"h2".equals(tag) || "h3".equals(tag) || "h4".equals(tag)) { || "a".equals(tag) || "td".equals(tag)
buff.append(text); || "th".equals(tag) || "h1".equals(tag)
} else if(text.trim().length() > 0) { || "h2".equals(tag) || "h3".equals(tag)
System.out.println(f.getName() + " invalid wrapper tag for text: " + tag + " text: " + text); || "h4".equals(tag) || "body".equals(tag)
// System.out.println(parser.getRemaining()); || "b".equals(tag) || "code".equals(tag)
} || "form".equals(tag) || "span".equals(tag)
} || "em".equals(tag)) {
} else if(event == XMLParser.START_ELEMENT) { buff.append(clean(text));
} else if ("pre".equals(tag) || "title".equals(tag)) {
// ignore, don't translate
} else {
System.out.println(f.getName()
+ " invalid wrapper tag for text: " + tag
+ " text: " + text);
// System.out.println(parser.getRemaining());
}
} else if (event == XMLParser.START_ELEMENT) {
stack.add(tag);
String name = parser.getName(); String name = parser.getName();
if("pre".equals(name) || "title".equals(name)) { if ("code".equals(name) || "a".equals(name) || "b".equals(name)
translate = false; || "span".equals(name)) {
} else if("p".equals(name) || "li".equals(name) || "a".equals(name) || // keep tags if wrapped, but not if this is the wrapper
"td".equals(name) || "th".equals(name) || "h1".equals(name) || if (buff.length() > 0) {
"h2".equals(name) || "h3".equals(name) || "h4".equals(name)) { buff.append(parser.getToken().trim());
translate = true; ignoreEnd = false;
if("".equals(tag)) { } else {
tag = name; ignoreEnd = true;
}
} else if ("p".equals(tag) || "li".equals(tag)
|| "td".equals(tag) || "th".equals(tag)
|| "h1".equals(tag) || "h2".equals(tag)
|| "h3".equals(tag) || "h4".equals(tag)
|| "body".equals(tag) || "form".equals(tag)) {
if (buff.length() > 0) {
add(prop, documentName + "_" + (1000 + id++) + "_"
+ tag, buff);
} }
} else if(translate && ("code".equals(name) || "a".equals(name))) {
buff.append(parser.getToken());
} }
} else if(event == XMLParser.END_ELEMENT) { tag = name;
} else if (event == XMLParser.END_ELEMENT) {
String name = parser.getName(); String name = parser.getName();
if("pre".equals(name)) { if ("code".equals(name) || "a".equals(name) || "b".equals(name)
translate = true; || "span".equals(name) || "em".equals(name)) {
} else if(tag.equals(name)) { if (!ignoreEnd && buff.length() > 0) {
translate = false; buff.append(parser.getToken().trim());
tag = ""; }
} else if(translate) { } else {
if("code".equals(name) || "a".equals(name)) { if (buff.length() > 0) {
buff.append(parser.getToken()); add(prop, documentName + "_" + (1000 + id++) + "_"
} + tag, buff);
} }
translate = true; }
} else if(event == XMLParser.DTD) { tag = (String) stack.pop();
} else if(event == XMLParser.COMMENT) { } else if (event == XMLParser.DTD) {
} else if (event == XMLParser.COMMENT) {
} else { } else {
int eventType = parser.getEventType(); int eventType = parser.getEventType();
throw new Exception("Unexpected event " + eventType + " at " + parser.getRemaining()); throw new Exception("Unexpected event " + eventType + " at "
+ parser.getRemaining());
}
} }
storeProperties(prop, documentName + ".properties");
} }
// writer.close();
private static String clean(String text) {
if (text.indexOf('\r') < 0 && text.indexOf('\n') < 0) {
return text;
}
text = text.replace('\r', ' ');
text = text.replace('\n', ' ');
text = StringUtils.replaceAll(text, " ", " ");
text = StringUtils.replaceAll(text, " ", " ");
return text;
}
private static void add(Properties prop, String document, StringBuffer text) {
String s = text.toString().trim();
text.setLength(0);
prop.setProperty(document, s);
} }
private static void prepare(String baseDir, String path) throws IOException { private static void prepare(String baseDir, String path) throws IOException {
...@@ -137,10 +173,10 @@ public class PrepareTranslation { ...@@ -137,10 +173,10 @@ public class PrepareTranslation {
File[] list = dir.listFiles(); File[] list = dir.listFiles();
File main = null; File main = null;
ArrayList translations = new ArrayList(); ArrayList translations = new ArrayList();
for(int i=0; list != null && i<list.length; i++) { for (int i = 0; list != null && i < list.length; i++) {
File f = list[i]; File f = list[i];
if(f.getName().endsWith(".properties")) { if (f.getName().endsWith(".properties")) {
if(f.getName().endsWith("_" + MAIN_LANGUAGE + ".properties")) { if (f.getName().endsWith("_" + MAIN_LANGUAGE + ".properties")) {
main = f; main = f;
} else { } else {
translations.add(f); translations.add(f);
...@@ -148,48 +184,57 @@ public class PrepareTranslation { ...@@ -148,48 +184,57 @@ public class PrepareTranslation {
} }
} }
Properties p = FileUtils.loadProperties(main.getAbsolutePath()); Properties p = FileUtils.loadProperties(main.getAbsolutePath());
Properties base = FileUtils.loadProperties(baseDir + "/" + main.getName()); Properties base = FileUtils.loadProperties(baseDir + "/"
+ main.getName());
storeProperties(p, main.getAbsolutePath()); storeProperties(p, main.getAbsolutePath());
for(int i=0; i<translations.size(); i++) { for (int i = 0; i < translations.size(); i++) {
File trans = (File) translations.get(i); File trans = (File) translations.get(i);
prepare(p, base, trans); prepare(p, base, trans);
} }
storeProperties(p, baseDir + "/" + main.getName()); storeProperties(p, baseDir + "/" + main.getName());
} }
private static void prepare(Properties main, Properties base, File trans) throws IOException { private static void prepare(Properties main, Properties base, File trans)
throws IOException {
Properties p = FileUtils.loadProperties(trans.getAbsolutePath()); Properties p = FileUtils.loadProperties(trans.getAbsolutePath());
// add missing keys, using # and the value from the main file // add missing keys, using # and the value from the main file
Iterator it = main.keySet().iterator(); Iterator it = main.keySet().iterator();
while(it.hasNext()) { while (it.hasNext()) {
String key = (String) it.next(); String key = (String) it.next();
String now = main.getProperty(key); String now = main.getProperty(key);
if(!p.containsKey(key)) { if (!p.containsKey(key)) {
System.out.println(trans.getName() + ": key " + key + " not found in translation file; added dummy # 'translation'"); System.out
.println(trans.getName()
+ ": key "
+ key
+ " not found in translation file; added dummy # 'translation'");
p.put(key, "#" + now); p.put(key, "#" + now);
} else { } else {
String last = base.getProperty(key); String last = base.getProperty(key);
if(last != null && !last.equals(now)) { if (last != null && !last.equals(now)) {
// main data changed since the last run: review translation // main data changed since the last run: review translation
System.out.println(trans.getName() + ": key " + key + " changed; last=" + last + " now=" + now); System.out.println(trans.getName() + ": key " + key
+ " changed; last=" + last + " now=" + now);
String old = p.getProperty(key); String old = p.getProperty(key);
p.put(key, "#" + now + " #" + old); p.put(key, "#" + now + " #" + old);
} }
} }
} }
// remove keys that don't exist in the main file (deleted or typo in the key) // remove keys that don't exist in the main file (deleted or typo in the
// key)
it = new ArrayList(p.keySet()).iterator(); it = new ArrayList(p.keySet()).iterator();
while(it.hasNext()) { while (it.hasNext()) {
String key = (String) it.next(); String key = (String) it.next();
if(!main.containsKey(key) && !key.startsWith(DELETED_PREFIX)) { if (!main.containsKey(key) && !key.startsWith(DELETED_PREFIX)) {
String newKey = key; String newKey = key;
while(true) { while (true) {
newKey = DELETED_PREFIX + newKey; newKey = DELETED_PREFIX + newKey;
if(!p.containsKey(newKey)) { if (!p.containsKey(newKey)) {
break; break;
} }
} }
System.out.println(trans.getName() + ": key " + key + " not found in main file; renamed to " + newKey); System.out.println(trans.getName() + ": key " + key
+ " not found in main file; renamed to " + newKey);
p.put(newKey, p.getProperty(key)); p.put(newKey, p.getProperty(key));
p.remove(key); p.remove(key);
} }
...@@ -197,7 +242,8 @@ public class PrepareTranslation { ...@@ -197,7 +242,8 @@ public class PrepareTranslation {
storeProperties(p, trans.getAbsolutePath()); storeProperties(p, trans.getAbsolutePath());
} }
static void storeProperties(Properties p, String fileName) throws IOException { static void storeProperties(Properties p, String fileName)
throws IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream();
p.store(out, null); p.store(out, null);
ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
...@@ -205,12 +251,12 @@ public class PrepareTranslation { ...@@ -205,12 +251,12 @@ public class PrepareTranslation {
LineNumberReader r = new LineNumberReader(reader); LineNumberReader r = new LineNumberReader(reader);
FileWriter w = new FileWriter(fileName); FileWriter w = new FileWriter(fileName);
PrintWriter writer = new PrintWriter(new BufferedWriter(w)); PrintWriter writer = new PrintWriter(new BufferedWriter(w));
while(true) { while (true) {
String line = r.readLine(); String line = r.readLine();
if(line == null) { if (line == null) {
break; break;
} }
if(!line.startsWith("#")) { if (!line.startsWith("#")) {
writer.println(line); writer.println(line);
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论