Questions tagged [h2db]

H2 is an open source SQL database engine 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 disk footprint (size of the jar file) is about 1 MB.

H2 is an open source SQL database engine 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 disk footprint (size of the jar file) is about 1 MB.

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.

This tag is synonym for H2 tag

Wiki

Issues

93 questions
2
votes
7 answers

Unable to connect H2 DB with Hibernate

I am trying to create a small H2 in-memory database while using hibernate. But the table is not dispplayed in the H2 UI. I'm not sure if I need to include anything else in the configuration. Here is the code: Below are dependencies added for…
coder123
  • 461
  • 2
  • 9
  • 14
2
votes
1 answer

hibernate hierarchy: NULL not allowed for discriminator column

I have an entity hierarchy based on hibernate strategy SINGLE_TABLE and I set ddl-auto=update in my application.yml. When I run tests, using h2db, I get "NULL not allowed for column ". This is my mapping: ================== Shape |-->…
Fabio Formosa
  • 904
  • 8
  • 27
2
votes
3 answers

Trouble with Integration Testing MySQL Syntax on an H2 Database in Spring

I am working on a project which uses different MySQL schemas for customer management, e.G. every customer has his own database schema, which is created with a skeleton template. For compatibility issues, I have to create new MySQL schemas from Java,…
2
votes
0 answers

Running H2DB on Tomcat for Spark-Java Web App

My Spark Java app runs perfectly fine on it's embedded Jetty server with all h2database connections working fine. I packaged a war to run it on tomcat 8. However, once I deploy the war to tomcat. The connection to h2databse fails!! How to fix this…
2
votes
1 answer

How to delete rows from H2 table with commited changes after each Junit test

I am using H2 in-memory DB for unit testing interaction with a database. I need to clean commited changes in @After so that tables stay but all rows get wiped away (thus I cannot just drop tables). My database also has many foreign keys which makes…
Iwavenice
  • 556
  • 5
  • 22
2
votes
0 answers

DBUnit cannot import data into H2 DB by xml file

I'm doing DBUnit 2.5.0 and h2 db, a memory database 1.4.180 for TestNG. I use DBUnit to export dataschema from db (PostgreSQL). Then I use this xml file for H2 DB, but whenever I run testNG, it thrown an exception:…
Phong Nguyen
  • 277
  • 4
  • 16
2
votes
1 answer

Why doesn't ScalaQuery create ddl for foreign key?

I have the following table definitions using ScalaQuery 0.10.0-M1: import org.scalaquery.ql.basic.{ BasicTable => Table } object Nodes extends Table[(String, String)]("node") { def id = column[String]("id", O.PrimaryKey) def name =…
Jens Schauder
  • 77,657
  • 34
  • 181
  • 348
1
vote
0 answers

H2 database migration from 1.4.192 to 2.1.210

I have migrated my h2db.mv.db from 1.4.192 to 2.1.210. All works well application started with the new version of h2(smoothly) but suddenly what I see in my application that h2 database have dropped some tables on its own(runtime). I am not sure why…
Shubham kapoor
  • 394
  • 3
  • 18
1
vote
1 answer

Can not create alias `IF` or `IFNULL`

I am trying to create an alias in H2database for IF and I get the following error. org.h2.jdbc.JdbcSQLSyntaxErrorException: Function alias "IF" already exists; SQL statement: CREATE ALIAS `IF` FOR "test.Udf.ifAlias" [90076-212] Then I try to drop…
Sabuj Hassan
  • 38,281
  • 14
  • 75
  • 85
1
vote
1 answer

Using xml-functions in h2 database for university project

For my university-project I installed an h2database locally on my computer. I have a little data in it and now I am trying to export parts of this data via the included xml-functions that h2 offers. However I do not really get how this works. I am…
Yannick251
  • 21
  • 4
1
vote
0 answers

H2 DB multipole connections in AWS EFS using AWS Lambda

I have been struggling to find a solution for below use case for H2 database I have an H2 db file This file has been kept in AWS EFS This is because two lambda functions can access this DB file concurrently. One lambda reads the file and other…
Atul
  • 1,560
  • 5
  • 30
  • 75
1
vote
1 answer

Empty SESSION Table in Keycloak H2 Database

I'm using Keycloak 15.0.2 with the default H2 database. I have logged in several users and can get active session in the Keycloak session tab, but in DB, I cannot see any entries in all tables related to sessions like USER_SESSION and…
b0w92
  • 55
  • 8
1
vote
1 answer

H2 show value of DB_CLOSE DELAY (set by SET DB_CLOSE_DELAY)

The H2 Database has a list of commands starting with SET, in particular SET DB_CLOSE_DELAY. I would like to find out what the value of DB_CLOSE_DELAY is. I am using JDBC. Setting is easy cx.createStatement.execute("SET DB_CLOSE_DELAY 0") but none…
rp1703
  • 13
  • 3
1
vote
2 answers

H2 Database - Throwing General error: "java.lang.IllegalStateException: Unable to read the page at position 2199023614787

I am developing an application which uses a H2 database. Used this tech in the past with no issues, but when downloading a fresh copy of the h2 database and running the jar, I am unable to login using the default settings! I am running…
DeltaRage
  • 119
  • 1
  • 3
  • 16
1
vote
1 answer

H2DB - MS SQL Server Compatibility mode not working

I am trying to write unit/integration test cases for a Java codebase connecting to MS SQL Server. In this effort, am able to successfully copy all my SQL Server tables over to a H2 Database file and run my unit tests on the H2 DB. I have thoroughly…
Srini M
  • 196
  • 3
  • 16