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
32
votes
3 answers

JPA/Hibernate support for migration?

I'm currently working on a desktop application using JPA/Hibernate to persist data in a H2 database. I'm curious what my options are if I need to make changes to the database schema in the future for some reason. Maybe I'll have to introduce new…
willcodejavaforfood
  • 43,223
  • 17
  • 81
  • 111
32
votes
4 answers

Spring Boot. @DataJpaTest H2 embedded database create schema

I have couple of entities in my data layer stored in particular schema. For example: @Entity @Table(name = "FOO", schema = "DUMMY") public class Foo {} I'm trying to setup H2 embedded database for integration testing of my data layer. I'm using…
32
votes
3 answers

H2 database console spring boot Load denied by X-Frame-Options

I`m building a skeletal project for dev with spring 4 boot security and others. Using H2 while attempting to log into the db console and manage my db i get the following error. The page is blank, with 4 bugs in firebug konsole : Load denied by…
32
votes
3 answers

Are there any reasons why h2 database shouldn't be used in production?

I am recently considering making an application that uses h2 database as its main database (because it comes with JBoss), but I am bit worried about that. I have read in a few places (discussion boards mainly) that one should not use h2 in…
bjedrzejewski
  • 2,378
  • 2
  • 25
  • 46
31
votes
6 answers

Access to h2 web console while running junit test in a Spring application

I'm building a Spring application and I need to inspect my H2 in-memory database while I'm running my JUnit tests from a web browser. In my Spring configuration I have a bean which is responsible of creating my database schema and populating it with…
Ivan Fernandez
  • 4,173
  • 5
  • 25
  • 30
30
votes
5 answers

Spring Boot + IntelliJ + Embedded Database = Headache

Either I'm missing some core concept buried deep within some documentation (Spring, Spring Boot, H2, HSQLDB, Derby, IntelliJ) or I've been staring at this for too long. I have a Spring Boot project going. Tried using and initializing an H2 DB at…
Jack
  • 9,156
  • 4
  • 50
  • 75
30
votes
3 answers

Export data from H2 database into CSV

I have a stand alone H2 server up and running gathering data. For testing I want to get data out my server into a CSV file. Are there any tools for that?
user1633277
  • 510
  • 2
  • 7
  • 14
29
votes
24 answers

Database not found, and IFEXISTS=true, so we cant auto-create it

I am getting error after opening the h2 database console. I enter database name but it is showing database not found error: Database "C:/Users/Barlekar/onlineshoppings" not found, and IFEXISTS=true, so we cant auto-create it [90146-199]…
sonal barlekar
  • 311
  • 1
  • 3
  • 3
29
votes
1 answer

H2 postgresql mode seems not working for me

My application accesses Postgres database and I have many predefined queries (Rank, Partition, complex join etc) I fire against Postgres. Now I want to go for unit testing these queries behaviour with small test data. So I started with H2/JUnit. I…
Umesh K
  • 13,436
  • 25
  • 87
  • 129
29
votes
8 answers

H2 Console Cant see tables created by JAVA

I have downloaded the H2 console from http://www.h2database.com/html/download.html and I have configured the URL in my jdbc.properties file to jdbc:h2:c:/data/Messaging. I am using the same URL in the file to connect to the database but I cannot see…
Dunken
  • 1,311
  • 7
  • 18
  • 30
29
votes
2 answers

How to use current date in H2 database SQL query

I need something like select * from tableName where date_column > now() However, now() doesn't work in H2. Please advise.
Pavel Vyazankin
  • 1,470
  • 6
  • 18
  • 27
28
votes
5 answers

What is the proper way to close H2?

This is related to this post. I think I am having problem with H2 meaning that it does not close properly. I suspect this since I see myDB.lock.db when I shutdown tomcat and the process does not stop. I use Tomcat's connection pooling and the url to…
Jim
  • 18,826
  • 34
  • 135
  • 254
28
votes
4 answers

Spring Boot Data JPA with H2 and data.sql - Table not Found

I have a Spring Boot 2.5.0 project. I'm using Spring Data JPA with the H2 in-memory database. I want to populate data on startup with a data.sql file but I'm getting a table not found exception. If I remove the data.sql file, I can see that a table…
cjt
  • 479
  • 1
  • 5
  • 9
28
votes
2 answers

Where are my H2 database files?

I'm just evaluating the H2 database... I downloaded and unpacked the installation and connect to a database at jdbc:h2:file:/home/konrad/test. /home/konrad is my home dir, test does not exist (I expect H2 to create it). The console seems to work OK.…
Konrad Garus
  • 53,145
  • 43
  • 157
  • 230
28
votes
12 answers

hibernate h2 embeddable list expected "identifier"

I'm trying to associate a list of function (whom Embeddable) within my Employee Entity and H2 seems unhappy with this saying that it expected an "identifier" Caused by: org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement " CREATE…
Nicolas Sagala Beaucage
  • 1,229
  • 1
  • 11
  • 23