Wiki source code of H2 Installation

Version 2.6 by Manuel Smeria on 2012/12/11

Show last authors
1 {{box cssClass="floatinginfobox" title="**Contents**"}}{{toc/}}{{/box}}
2
3 [[H2>>http://www.h2database.com/html/main.html]] is a fast, free, in memory or disc based java database.
4
5 This document assumes you know how to set up a database, and use it, so this just details how to use [[H2>>http://www.h2database.com/html/main.html]].
6
7 = Changes to Hibernate.cfg.xml =
8
9 There are two ways you can connect to your database, either via a server managed JDBC pool or by a hibernate managed pool.
10
11 == When using a JDBC datasource ==
12
13 {{code language="xml"}}
14 <property name="connection.datasource">java:comp/env/jdbc/XWikiDS</property>
15 <property name="dialect">org.hibernate.dialect.H2Dialect</property>
16 {{/code}}
17
18 == When letting hibernate manage your pools ==
19
20 {{code language="xml"}}
21 <property name="connection.url">jdbc:h2:tcp://remotehost/xwiki23</property>
22 <property name="connection.username">xwiki</property>
23 <property name="connection.password">xwikipw</property>
24 <property name="connection.driver_class">org.h2.Driver</property>
25 <property name="dialect">org.hibernate.dialect.H2Dialect</property>
26 <property name="connection.provider_class">com.xpn.xwiki.store.DBCPConnectionProvider</property>
27 <property name="connection.pool_size">20</property>
28 {{/code}}
29
30 = H2 Database =
31
32 For those who are wondering how I got H2 running on a remote machine, the command line I used is:
33
34 {{code language="bash"}}
35 java -cp ./h2-1.2.136.jar org.h2.tools.Server -web -tcp -tcpAllowOthers -baseDir /var/spool/javadb/h2
36 {{/code}}
37
38 Thus any database you create will be stored in this location, so with the above example I will have a database called ##/var/spool/javadb/h2/xwiki23##.

Get Connected