99

如何使用H2 数据库的集成管理前端?

用于创建表、更改表、添加列等操作。

4

10 回答 10

91

我喜欢SQuirreL SQL Client,而NetBeans非常好用;但更多时候,我只是启动内置org.h2.tools.Server并浏览端口 8082:

$ java -cp /opt/h2/bin/h2.jar org.h2.tools.Server -help
启动 H2 控制台 (web-) 服务器、TCP 和 PG 服务器。
用法:java org.h2.tools.Server
不带选项运行时,会启动 -tcp、-web、-browser 和 -pg。
选项区分大小写。支持的选项有:
[-help] 或 [-?] 打印选项列表
[-web] 使用 H2 控制台启动 Web 服务器
[-webAllowOthers] 允许其他计算机连接 - 见下文
[-webPort ] 端口(默认:8082)
[-webSSL] 使用加密 (HTTPS) 连接
[-browser] 启动浏览器并打开一个页面以连接到 Web 服务器
[-tcp​​] 启动 TCP 服务器
[-tcp​​AllowOthers] 允许其他计算机连接 - 见下文
[-tcp​​Port ] 端口(默认:9092)
[-tcp​​SSL] 使用加密 (SSL) 连接
[-tcp​​Password ] 关闭 TCP 服务器的密码
[-tcp​​Shutdown ""] 停止 TCP 服务器;示例:tcp://localhost:9094
[-tcp​​ShutdownForce] 不要等到所有连接都关闭
[-pg] 启动 PG 服务器
[-pgAllowOthers] 允许其他计算机连接 - 见下文
[-pgPort ] 端口(默认值:5435)
[-baseDir ] H2 数据库的基本目录;对于所有服务器
[-ifExists] 只能打开现有数据库;对于所有服务器
[-trace] 打印额外的跟踪信息;对于所有服务器
于 2010-05-03T23:10:48.677 回答
33

H2 控制台应用程序怎么样?

于 2010-05-24T13:14:18.577 回答
20

我使用sql-workbench来处理 H2 和我必须处理的任何其他 DBMS,它让我微笑 :-)

于 2011-08-11T03:55:25.957 回答
13

我想建议DBEAVER 。它基于 eclipse 并支持更好的数据处理

于 2014-04-28T10:32:48.083 回答
7

内置的 shell 客户端也很方便。

java -cp h2*.jar org.h2.tools.Shell

http://opensource-soa.blogspot.com.au/2009/03/how-to-use-h2-shell.html

$ java -cp h2.jar org.h2.tools.Shell -help
Interactive command line tool to access a database using JDBC.
Usage: java org.h2.tools.Shell <options>
Options are case sensitive. Supported options are:
[-help] or [-?]        Print the list of options
[-url "<url>"]         The database URL (jdbc:h2:...)
[-user <user>]         The user name
[-password <pwd>]      The password
[-driver <class>]      The JDBC driver class to use (not required in most cases)
[-sql "<statements>"]  Execute the SQL statements and exit
[-properties "<dir>"]  Load the server properties from this directory
If special characters don't work as expected, you may need to use
 -Dfile.encoding=UTF-8 (Mac OS X) or CP850 (Windows).
See also http://h2database.com/javadoc/org/h2/tools/Shell.html
于 2014-09-03T00:55:25.930 回答
3

我没用过,但是RazorSQL 看起来还不错。

于 2010-05-03T20:12:38.380 回答
1

我建议使用 Jetbrain 的 IDE:DataGrip https://www.jetbrains.com/datagrip/

于 2014-08-23T01:43:59.020 回答
1

如果您在 spring 中将其作为嵌入式数据库运行,我使用以下配置在主应用程序运行时启用内置 Web 客户端:

<!-- Run H2 web server within application that will access the same in-memory database -->
<bean id="h2Server" class="org.h2.tools.Server" factory-method="createTcpServer" init-method="start" destroy-method="stop" depends-on="h2WebServer">
    <constructor-arg value="-tcp,-tcpAllowOthers,-tcpPort,9092"/>
</bean>
<bean id="h2WebServer" class="org.h2.tools.Server" factory-method="createWebServer" init-method="start" destroy-method="stop">
    <constructor-arg value="-web,-webAllowOthers,-webPort,8082"/>
</bean>
于 2015-06-28T07:37:00.560 回答
1

我经常使用 DbVisualizer 进行 H2-db 管理。

有一个免费版本:

https://www.dbvis.com/download/

于 2015-10-14T18:51:14.593 回答