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.
4,428
questions
216votes
21answers
214kviews
H2 in-memory database. Table not found
I've got a H2 database with URL "jdbc:h2:test". I create a table using CREATE TABLE PERSON (ID INT PRIMARY KEY, FIRSTNAME VARCHAR(64), LASTNAME VARCHAR(64));. I then select everything from this (empty)...
122votes
14answers
262kviews
Spring Boot default H2 jdbc connection (and H2 console)
I am simply trying to see the H2 database content for an embedded H2 database which spring-boot creates when I don't specify anything in my application.properties and start with mvn spring:run. I can ...
110votes
6answers
140kviews
Can I have H2 autocreate a schema in an in-memory database?
(I've already seen the H2 database In memory - Init schema via Spring/Hibernate question; it is not applicable here.)
I'd like to know if there's a setting in H2 that will allow me to auto-create a ...
99votes
10answers
150kviews
Frontend tool to manage H2 database [closed]
How to use H2 database's integrated managment frontend?
For operations such as create table, alter table, add column, and so on.
94votes
11answers
118kviews
View content of H2 or HSQLDB in-memory database
Is there a way to browse the content of an H2 or an HSQLDB in-memory database for viewing? For example, during a debugging session with Hibernate in order to check when the flush is executed; or to ...
91votes
2answers
85kviews
Which is better H2 or HSQLDB? [closed]
HSQLDB 2.0 is soon to be released. I wonder if it will outperform H2 since, as far as I know, most users prefer H2 than HSQLDB. I am interested in the MVCC support of HSQLDB 2.0. I have learned that ...
83votes
5answers
108kviews
Connect to H2 database using IntelliJ database client
My Grails app uses a h2 database in dev mode (the default behaviour for Grails apps). The DB connection settings in DataSource.groovy are
dataSource {
pooled = true
jmxExport = true
...
75votes
6answers
107kviews
How to find rows in one table that have no corresponding row in another table
I have a 1:1 relationship between two tables. I want to find all the rows in table A that don't have a corresponding row in table B. I use this query:
SELECT id
FROM tableA
WHERE id NOT IN (...
74votes
6answers
95kviews
How to configure spring-boot to use file based H2 database
I have successfully created a spring boot application that uses the H2 embedded database in-memory. I would now like to change this to a file based version that will persist.
I have tried just ...
70votes
4answers
78kviews
Executing script file in h2 database
First of all I would like to say am new to h2 database. I need to execute a sql script file in h2 database. I have a script file test.sql and I want to execute this in h2 database. Is it possible?
69votes
3answers
53kviews
How in H2DB get sql dump like in MySql?
I have H2DB database which stores data in files. I have 3 files: test.18.log.db, test.data.db, and test.index.db.
I want get SQL dump file like when I use mysqldump. Is it possible?
68votes
5answers
128kviews
auto increment ID in H2 database
Is there a way to have an auto_incrementing BIGINT ID for a table.
It can be defined like so
id bigint auto_increment
but that has no effect (it does not increment automatically).
I would like to ...
57votes
2answers
30kviews
problem with INIT=RUNSCRIPT and relative paths
I use maven conventions for source paths (src/main src/test) and i have my sql scripts in src/main/resources/scripts.
I want to run my app with H2 memory and i'd like to use the jdbc url to ...
55votes
15answers
124kviews
H2 database error: Database may be already in use: "Locked by another process"
I am trying to use the H2 database from a Java application.
I created the database and its tables through the H2 Console and then I try to connect from Java using
Connection con = DriverManager....
55votes
7answers
66kviews
View content of embedded H2 database started by Spring
I would like to view in a web browser the content of the H2 database started by Spring thanks to the following configuration:
<jdbc:embedded-database id="dataSource" type="H2" />
<jdbc:...