Questions tagged [h2]

H2 is a relational database management system written in Java. It can be embedded in Java applications or run in the client-server mode. H2 supports regular disk-based as well as in-memory databases.

The software is available as open source software under modified versions of the Mozilla Public License or the original Eclipse Public License. The main features of H2 are:

  • Very fast, open source, JDBC API
  • Embedded and server modes; in-memory databases
  • Browser based Console application
  • Small footprint: around 2 MB jar file size

The main author of H2 is Thomas Mueller, who also developed the Java database engine Hypersonic SQL. The name H2 stands for Hypersonic 2, however H2 does not share code with Hypersonic SQL or HSQLDB.

Wiki

Issues

API

4948 questions
42
votes
4 answers

How reliable is h2 database?

When I ask this question, I see that the current version of H2 database was released on 07-01-2011 (very recently). That is very good & healthy. Will this pace be kept? event if the pace of new releases are slow, will it be supported by opensource…
Muthu
  • 2,675
  • 4
  • 28
  • 34
41
votes
9 answers

Starting an H2 Database Server from Maven?

Suppose I want to create and use an H2 database for my integration tests. Maven has a command to run tests: mvn test. Is there a way to tell maven to start an H2 database server for the tests and stop it when it's done? I imagine this working…
roufamatic
  • 18,187
  • 7
  • 57
  • 86
40
votes
4 answers

H2 database: NULL not allowed for column "ID" when inserting record using jdbcTemplate

I use hibernate's hbm2ddl to generate schema automatically. Here is my domain: @Entity public class Reader { @Id @GeneratedValue(strategy=GenerationType.AUTO) Long id; @Column(nullable=false,unique=true) String name; …
Guisong He
  • 1,886
  • 1
  • 15
  • 27
40
votes
3 answers

create if not exists view?

Is there any way to create view if not exists in MySQL or H2 Database?
kumar kasimala
  • 759
  • 1
  • 6
  • 17
40
votes
10 answers

How to see all tables in my h2 database at localhost:8082?

I use JDBC and created h2 database called usaDB from sql script. Then I filled all tables with jdbc. The problem is that after I connect to usaDB at localhost:8082 I cannot see on the left tree my tables. There is only INFORMATION_SCHEMA database…
Volodymyr Levytskyi
  • 3,364
  • 9
  • 46
  • 83
39
votes
2 answers

Why is my embedded h2 program writing to a .mv.db file

I followed the quickstart guide on the h2 database website to create a new database a table and insert some data. The application runs smooth and can read and write to the database without problems. Quickstart h2 Add the h2*.jar to the classpath…
FelixZett
  • 598
  • 1
  • 5
  • 14
39
votes
5 answers

H2: how to tell if table exists?

I'm trying to write Java code that checks to see if an H2 table exists: if it doesn't exist, it first executes a CREATE TABLE query that creates the table before it proceeds any further. I followed the advice in this Google Groups question but it…
user1768830
38
votes
2 answers

insert a BLOB via a sql script?

I have an H2 database (http://www.h2database.com) and I'd like to insert a file into a BLOB field via a plain simple sql script (to populate a test database for instance). I know how to do that via the code but I cannot find how to do the sql script…
dm76
  • 4,130
  • 8
  • 35
  • 46
37
votes
7 answers

Tomcat doesn't stop. How can I debug this?

I have a Tomcat 7 running in Linux that I start via $CATALINA_HOME/bin/startup.sh and shutdown via $CATALINA_HOME/bin/shutdown.sh from /etc/init.d All is ok except 1 problem. Sometimes tomcat does not stop. Although I stop it and I see in…
Jim
  • 18,826
  • 34
  • 135
  • 254
37
votes
1 answer

H2 database string to timestamp

Insertion of timestamps in H2 database Hello, I have to insert data like '17-09-2012 18:47:52.69'. Function PARSEDATETIME cuts milliseconds. Query example: CREATE TABLE TEST(ID NUMBER(19) not null, DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP); INSERT…
shprotova
  • 535
  • 1
  • 5
  • 8
36
votes
6 answers

How to run H2 database in server mode?

I need to start H2 database in server mode from my application. Having tried the following code: server = Server.createTcpServer().start(); Here is the properties for the connection: javabase.jdbc.url =…
Feras Odeh
  • 9,136
  • 20
  • 77
  • 121
36
votes
3 answers

H2 Console throwing a error webAllowOthers in H2 database

I am using heruko to deploy my application when i am trying to load my h2 console using heruko it is throwing an error saying. H2 Console Sorry, remote connections ('webAllowOthers') are disabled on this server. i am using the below settings in my…
chaitanya
  • 391
  • 1
  • 3
  • 9
34
votes
4 answers

Create an in-memory database structure from an Oracle instance

I have an application where many "unit" tests use a real connection to an Oracle database during their execution. As you can imagine, these tests take too much time to be executed, as they need to initialize some Spring contexts, and communicate to…
Romain Linsolas
  • 79,475
  • 49
  • 202
  • 273
33
votes
3 answers

How to use DESC command in H2 Database?

My friend showed me in ORACLE that using DESC Table NAme was showing information about columns of table. But running this command in H2 Database was giving error, Why? and please tell how to use this command in H2? Thanks.
user1204320
  • 341
  • 1
  • 3
  • 8
33
votes
3 answers

Embedding the Java h2 database programmatically

At the moment we use HSQLDB as an embedded database, but we search for a database with less memory footprint as the data volume grows. Derby / JavaDB is not an option at the moment because it stores properties globally in the system properties. So…
Georgi
  • 4,402
  • 4
  • 24
  • 20