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

--no commit message

--no commit message
上级 1b68cfa3
......@@ -24,18 +24,18 @@ Build
<br /><a name="portability"></a>
<h2>Portability</h2>
This database is written in Java and therefore works on many platforms.
It is also possible to compile it to a native executable using GCJ.
It can also be compiled to a native executable using GCJ.
<br /><a name="environment"></a>
<h2>Environment</h2>
To build the database executables, the following software stack was used.
In most cases, newer version or compatible software works too, but this was not tested.
In most cases, newer version or compatible software works too.
<ul>
<li>Windows XP
</li><li>Sun JDK Version 1.4
</li><li>Sun JDK Version 1.4 or 1.5
</li><li>Apache Ant Version 1.6.5
</li><li>Mozilla Firefox 1.5
</li><li>Eclipse Version 3.2.1
</li><li>Eclipse Version 3.2.2
</li><li>YourKit Java Profiler
</li></ul>
......
......@@ -37,16 +37,18 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
<h3>Version 1.0 (Current)</h3>
<h3>Version 1.0 / TODO (Build TODO)</h3><ul>
<li>The default database name in the documentation is now jdbc:h2:~/test. Like this, the database
is stored in the user home directory (system property user.home). Of course storing the database
in the current working directory (as in jdbc:h2:test) still works. Using the user directory avoids
the problem that the database is not found if the application runs in another directory than
the console.
<li>Now PreparedStatement.setBigDecimal(..) can be called with an object of a derrived class
if the system property h2.allowBigDecimalExtensions is set to true.
</li><li>The default database name in the documentation is now jdbc:h2:~/test. Like this, the database
is stored in the user home directory (system property user.home). Of course storing the database
in the current working directory (as in jdbc:h2:test) still works. Using the user directory avoids
the problem that the database is not found if the application runs in another directory than
the console.
</li><li>The SQL statement SET ASSERT has been deprecated, because Constants.CHECK is now final.
To disable assertions (and improve performance), the system property h2.check can be used.
Executing SET ASSERT still works, but has no effect.
To disable assertions (and improve performance), the system property h2.check can be used.
Executing SET ASSERT still works, but has no effect.
</li><li>In the READ_COMMITTED mode, when the multi-threaded kernel is enabled,
read locks are now acquired but released immediately after a query.
read locks are now acquired but released immediately after a query.
</li><li>The default trace level for JdbcDataSourceFactory was DEBUG, so when using data sources a trace file
was always created. Now the default trace level is ERROR, and the file is only created if necessary.
</li><li>PooledConnection.getConnection took a long time if only one connection was open at any time. Fixed.
......
......@@ -23,20 +23,20 @@ Installation
<br /><a name="requirements"></a>
<h2>Requirements</h2>
To run the database, the following software stack is known to work.
Compatible software works too, but this was not tested.
To run the database, the following minimum software stack is known to work:
<ul>
<li>Windows XP
</li><li>Sun JDK Version 1.4
</li><li>Mozilla Firefox 1.5
<li>Windows XP, MacOS, or Linux
</li><li>Recommended Windows file system: NTFS (FAT32 supports files up to 4 GB)
</li><li>Sun JDK 1.4 or newer
</li><li>Mozilla Firefox 1.5 or newer
</li></ul>
<br /><a name="supported_platforms"></a>
<h2>Supported Platforms</h2>
As this database is written in Java, it can be run on many different platforms.
It is tested with Java 1.4 and 1.5, 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
developed and tested on Windows XP using the Sun JDKs, but probably 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.
<br /><a name="installing"></a>
......@@ -55,7 +55,7 @@ After installing, you should get the following directory structure:
</tr>
<tr>
<td>bin</td>
<td>Executables and JAR files</td>
<td>JAR and batch files</td>
</tr>
<tr>
<td>docs</td>
......@@ -73,6 +73,10 @@ After installing, you should get the following directory structure:
<td>odbc</td>
<td>ODBC drivers and tools</td>
</tr>
<tr>
<td>service</td>
<td>Tools to run the database as a Windows Serivce</td>
</tr>
<tr>
<td>src</td>
<td>Source files</td>
......
......@@ -33,7 +33,7 @@ Click <span class="button">Start</span>,
<img class="screenshot" src="quickstart-1.png" alt="screenshot: start H2 Console" /><br />
A new console window appears:<br />
<img class="screenshot" src="quickstart-2.png" alt="screenshot: H2 Running" /><br />
Also, a new browser page should open with URL <a href="http://localhost:8082" target="_blank">http://localhost:8082</a>.
Also, a new browser page should open with the URL <a href="http://localhost:8082" target="_blank">http://localhost:8082</a>.
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.
......
......@@ -38,39 +38,37 @@ This can be a H2 database, or another database that supports the JDBC API.
</p>
<img src="console.png" alt="Web Browser - H2 Console Server - H2 Database" />
<p>
This is a client / server application, so both a server and a client are required to run it.
This is a client / server application, so both a server and a client (a browser) are required to run it.
</p><p>
Depending on your platform and environment, there are multiple ways to start the application:
</p>
<table><tr><th>OS</th><th>Java</th><th>Start</th></tr>
<table><tr><th>OS</th><th>Start</th></tr>
<tr>
<td>Windows</td>
<td>1.4 or 1.5</td>
<td>
Click [Start], [All Programs], [H2], and [H2 Console (Command Line)]<br />
If this worked correctly, an icon will be added to the system tray:
Click [Start], [All Programs], [H2], and [H2 Console (Command Line)]<br />
When using the Sun JDK 1.4 or 1.5, a window with the title 'H2 Console ' should appear.
When using the Sun JDK 1.6, an icon will be added to the system tray:
<img src="h2.png" alt="[H2 icon]" /><br />
If you don't get the system tray icon, then maybe Java is not installed correctly (in this case, try another way to start the application).
If you don't get the window and the system tray icon,
then maybe Java is not installed correctly (in this case, try another way to start the application).
A browser window should open
and point to the Login page (URL: <a href="http://localhost:8082" target="_blank">http://localhost:8082</a>).
</td>
</tr>
<tr>
<td>Windows</td>
<td>1.4 or 1.5</td>
<td>
Open a file browser, navigate to h2/bin, and double click on h2.bat.<br />
If this worked correctly, an icon will be added to the system tray.
If there is a problem, you will see the error message on the console window.
A browser window will open
and point to the Login page (URL: <a href="http://localhost:8082" target="_blank">http://localhost:8082</a>).
Open a file browser, navigate to h2/bin, and double click on h2.bat.<br />
A console window appears. If there is a problem, you will see an error message
in this window. A browser window will open and point to the Login page
(URL: <a href="http://localhost:8082" target="_blank">http://localhost:8082</a>).
</td>
</tr>
<tr>
<td>Any</td>
<td>1.4 or 1.5</td>
<td>
Open a console window, navigate to the directory 'h2/lib' and type:
Open a console window, navigate to the directory 'h2/bin' and type:
<pre>
java -cp h2.jar org.h2.tools.Server
</pre>
......@@ -81,14 +79,13 @@ java -cp h2.jar org.h2.tools.Server
<h3>Firewall</h3>
<p>
If you start the server, you may get a security warning from the firewall (if you have installed one).
If you don't want other computers in the network to access the database on your machine, you can
If you don't want other computers in the network to access the application on your machine, you can
let the firewall block those connections. The connection from the local machine will still work.
Only if you want other computers to access the database on this computer, you need allow remote connections
in the firewall.
</p><p>
Please not that a small firewall is already built into the server. This mechanism by default does not
allow other computer to connect to the server. This can be changed in the Preferences
(Allow connections from other computers).
A small firewall is already built into the server: other computers may not connect to the server by default.
To change this, go to 'Preferences' and select 'Allow connections from other computers'.
</p>
<h3>Native Version</h3>
......
......@@ -69,8 +69,8 @@ import org.h2.message.TraceSystem;
*/
public class Constants {
public static final int BUILD_ID = 52;
private static final String BUILD = "2007-06-30";
public static final int BUILD_ID = 53;
private static final String BUILD = "2007-07-03";
public static final int VERSION_MAJOR = 1;
public static final int VERSION_MINOR = 0;
......@@ -248,6 +248,7 @@ public class Constants {
public static int MAX_FILE_RETRY = Math.max(1, getIntSetting("h2.maxFileRetry", 16));
public static boolean LOB_CLOSE_BETWEEN_READS = getBooleanSetting("h2.lobCloseBetweenReads", false);
public static boolean INDEX_OLD = getBooleanSetting("h2.indexOld", false);
public static final boolean ALLOW_BIG_DECIMAL_EXTENSIONS = getBooleanSetting("h2.allowBigDecimalExtensions", false);
public static final boolean INDEX_LOOKUP_NEW = getBooleanSetting("h2.indexLookupNew", true);
public static final boolean TRACE_IO = getBooleanSetting("h2.traceIO", false);
public static final int DATASOURCE_TRACE_LEVEL = getIntSetting("h2.dataSourceTraceLevel", TraceSystem.ERROR);
......
......@@ -699,6 +699,7 @@ public class MetaTable extends Table {
add(rows, new String[]{"h2.scriptDirectory", Constants.SCRIPT_DIRECTORY});
add(rows, new String[]{"h2.maxFileRetry", "" + Constants.MAX_FILE_RETRY});
add(rows, new String[]{"h2.lobCloseBetweenReads", "" + Constants.LOB_CLOSE_BETWEEN_READS});
add(rows, new String[]{"h2.allowBigDecimalExtensions", "" + Constants.ALLOW_BIG_DECIMAL_EXTENSIONS});
break;
}
case TYPE_INFO: {
......
......@@ -8,6 +8,7 @@ import java.math.BigDecimal;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import org.h2.engine.Constants;
import org.h2.message.Message;
import org.h2.util.MathUtils;
......@@ -32,7 +33,7 @@ public class ValueDecimal extends Value {
private ValueDecimal(BigDecimal value) {
if (value == null) {
throw new NullPointerException();
} else if(!value.getClass().equals(BigDecimal.class)) {
} else if(!Constants.ALLOW_BIG_DECIMAL_EXTENSIONS && !value.getClass().equals(BigDecimal.class)) {
SQLException e = Message.getSQLException(Message.INVALID_CLASS_2, new String[]{BigDecimal.class.getName(), value.getClass().getName()}, null);
throw Message.convertToInternal(e);
}
......
......@@ -7,7 +7,6 @@ package org.h2.test;
import java.sql.SQLException;
import java.util.Properties;
import org.h2.message.TraceSystem;
import org.h2.server.TcpServer;
import org.h2.test.jdbc.*;
import org.h2.test.jdbc.xa.TestXA;
......@@ -95,6 +94,8 @@ java -Xmx512m -Xrunhprof:cpu=samples,depth=8 org.h2.tools.RunScript -url jdbc:h2
/*
maybe another server server already
make sure INDEX_LOOKUP_NEW = is true by default.
Test Console (batch, javaw, different platforms)
test with openoffice (metadata changes)
......@@ -137,9 +138,6 @@ I will add this to the todo list.
Docs: Fix Quickstart
Dave Brewster (dbrewster at guidewire dot com): currency:
Add a setting to allow BigDecimal extensions
Send SQL Injection solution proposal to PostgreSQL, MySQL, Derby, HSQLDB,...
Improve LOB in directories performance
......@@ -148,8 +146,6 @@ Improve documentation for MAX_LENGTH_INPLACE_LOB
Convert SQL-injection-2.txt to html document, include SQLInjection.java sample
Integrate patches from Pavel Ganelin: www.dullesopen.com/software/h2-database-03-04-07-mod.src.zip
Test Eclipse DTP 1.5 (HSQLDB / H2 connection bug fixed)
Automate real power off tests
......@@ -167,12 +163,13 @@ support translated exceptions (translated, then english at the end, for Hibernat
make static member variables final (this helps find forgotten initializers)
Merge more from diff.zip (Pavel Ganelin)
Integrate patches from Pavel Ganelin: www.dullesopen.com/software/h2-database-03-04-07-mod.src.zip
inlining: try to shorten methods that are used very often
performance: try to shorten methods that are used very often
store dates as 'local'. Problem: existing files use GMT (use escape syntax)
drop table test;
CREATE TABLE TEST( ID BIGINT PRIMARY KEY, CREATEDON TIMESTAMP);
CREATE TABLE TEST( ID BIGINT PRIMARY KEY, CREATED TIMESTAMP);
INSERT INTO TEST VALUES(1, '2007-01-01 00:00:00');
SELECT * FROM TEST;
......
/*
* Copyright 2004-2006 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package org.h2.test.poweroff;
import java.io.File;
......@@ -24,11 +28,11 @@ import java.util.zip.ZipOutputStream;
import org.h2.util.IOUtils;
public class TestRecover {
private Random random;
private static final String RELATIVE = System.getProperty("h2.testRecoverPath", "db");
private static final String TEST_DIRECTORY = "/temp/"+RELATIVE+"/data";
private static final String BACKUP_DIRECTORY = "/temp/"+RELATIVE+"/last";
private static final String NODE = System.getProperty("h2.testRecoverPath", "1");
private static final String TEST_DIRECTORY = "/temp/db/data" + NODE;
private static final String BACKUP_DIRECTORY = "/temp/db/last";
public static void main(String[] args) throws Exception {
new TestRecover().runTest(args);
......@@ -37,7 +41,7 @@ public class TestRecover {
private void runTest(String[] args) throws Exception {
System.out.println("backup...");
new File(TEST_DIRECTORY).mkdirs();
File backup = backup(TEST_DIRECTORY, BACKUP_DIRECTORY, "data", 10);
File backup = backup(TEST_DIRECTORY, BACKUP_DIRECTORY, "data", 10, NODE);
System.out.println("check consistency...");
if(!testConsistency()) {
System.out.println("error! renaming file");
......@@ -49,7 +53,7 @@ public class TestRecover {
testLoop();
}
static File backup(String sourcePath, String targetPath, String basePath, int max) throws Exception {
static File backup(String sourcePath, String targetPath, String basePath, int max, String node) throws Exception {
File root = new File(targetPath);
if(!root.exists()) {
root.mkdirs();
......@@ -75,7 +79,7 @@ public class TestRecover {
}
SimpleDateFormat sd = new SimpleDateFormat("yyMMdd-HHmmss");
String date = sd.format(new Date());
File zipFile = new File(root, "backup-" + date + ".zip");
File zipFile = new File(root, "backup-" + date + "-" + node + ".zip");
ArrayList list = new ArrayList();
File base = new File(sourcePath);
listRecursive(list, base);
......@@ -108,7 +112,7 @@ public class TestRecover {
in = new FileInputStream(fileName);
IOUtils.copyAndCloseInput(in, zipOut);
} finally {
IOUtils.closeSilently(in);
IOUtils.closeSilently(in);
}
zipOut.closeEntry();
}
......@@ -163,7 +167,7 @@ public class TestRecover {
private void runOneTest(int i) throws Exception {
Random random = new Random(i);
Connection conn = openConnection();
PreparedStatement prep = null;
PreparedStatement prep = null;
while (true) {
boolean rollback = random.nextInt(10) == 1;
int len;
......@@ -180,20 +184,20 @@ public class TestRecover {
random.nextBytes(data);
int op = random.nextInt();
if (op % 100 == 0) {
conn.close();
conn = openConnection();
prep = null;
conn.close();
conn = openConnection();
prep = null;
}
if(prep == null) {
prep = conn.prepareStatement("INSERT INTO TEST(NAME) VALUES(?)");
conn.setAutoCommit(false);
}
if(prep == null) {
prep = conn.prepareStatement("INSERT INTO TEST(NAME) VALUES(?)");
conn.setAutoCommit(false);
}
prep.setString(1, "" + len);
prep.execute();
if (rollback) {
conn.rollback();
conn.rollback();
} else {
conn.commit();
conn.commit();
}
}
}
......@@ -215,11 +219,11 @@ public class TestRecover {
conn = openConnection();
ResultSet rs = conn.createStatement().executeQuery("SELECT * FROM TEST");
while(rs.next()) {
String name = rs.getString("NAME");
int value = Integer.parseInt(name);
if(value % 2 == 1) {
throw new Exception("unexpected odd entry " + rs.getInt("ID"));
}
String name = rs.getString("NAME");
int value = Integer.parseInt(name);
if(value % 2 == 1) {
throw new Exception("unexpected odd entry " + rs.getInt("ID"));
}
}
conn.close();
return true;
......
......@@ -478,6 +478,7 @@ incidentally brutal carefully pervasive testlob mydatetime antonio casqueiro syb
pad microsystems dullesopen rpad spot lpad ganelin sssz testabc pst dumping lots
chdh biz inventec
enclosing mostly dtp scrolls cars splitting replay incomplete automate
shorten
### evaluatable > evaluable
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论