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
2
votes
0 answers

Specifying path of CSV file in an SQL script (H2 database)

I have an H2 database file which is created by importing tables from CSV files, using the CSVREAD command provided by H2 (described here: http://www.h2database.com/html/tutorial.html#csv). The CSV files are just tables in text format, and are…
favq
  • 739
  • 1
  • 11
  • 25
2
votes
2 answers

Table not found after apparently successful migration

I was using flyway through the CL to migrate my production DB (mySql), while I was using a fixed SQL query to create the DB, tables, etc. in my unit tests, using H2. I'd like now to better integrate flyway and create/delete DB after each unit test.…
Luke
  • 307
  • 3
  • 12
2
votes
0 answers

SQL query within hibernate extremely slow while very fast using SQL cient

I know there have been quite a few similar questions but I cant find an answer to this one: I'm not very familiar with hibernate but I'm working on an app which contains an extremely slow hibernate query. This query is generated from a very simple…
remi
  • 3,914
  • 1
  • 19
  • 37
2
votes
1 answer

Karaf unresolved constraint JDBC

I am trying to get a Scala library using H2 database loading in Karaf 3.0.0-RC1 and I got this error Unresolved constraint in bundle org.h2 [86]: Unable to resolve 86.0: missing requirement [86.0] osgi.wiring.package;…
Bob
  • 8,424
  • 17
  • 72
  • 110
2
votes
1 answer

H2 database with unitils

I used the extension unitils to initialize my database with one of the data sets. With Mysql, HsqlDB and PostgreSql, I didn't have any problem, but with H2 I foudn problem. Is what somebody already tested H2 with unitils? If so, thank you to provide…
andolsi zied
  • 3,553
  • 2
  • 32
  • 43
2
votes
1 answer

Cannot see content of h2 database when using it "in-memory"

i am currently developing a spring mvc app with my domain models mapped to a h2 database by hibernate (4). My current problem is, that when i start the h2 webserver as bean (see context below) i cannot see the database when it´s created "in-memory"…
jubi
  • 485
  • 7
  • 19
2
votes
3 answers

grails h2 database create table

I have a really simple domain class class Person { String code } And I am also using default DataSource configuration: dataSource { pooled = true driverClassName = "org.h2.Driver" username = "sa" password = "" } hibernate { …
Bob
  • 10,427
  • 24
  • 63
  • 71
2
votes
1 answer

JdbcSQLException using GROUP BY on h2 Database

When I execute the following sql commands on an h2 database (version 1.3.161): CREATE TABLE Person ( id int NOT NULL AUTO_INCREMENT PRIMARY KEY, Name VARCHAR(10) ); CREATE TABLE Actor ( id int NOT NULL AUTO_INCREMENT PRIMARY KEY, PersonId…
ETN
  • 95
  • 2
  • 8
2
votes
1 answer

How to select date from H2 database

I am trying to run the following query against an H2 Database: SELECT ID FROM CONTEST WHERE CONTEST_DATE = 2004-03-01; I know that h2 doesn't support to_date, so how would I write this query? The CONTEST_DATE col is of type date.
user1154644
  • 4,491
  • 16
  • 59
  • 102
2
votes
1 answer

"Django Admin" like framework/app in Java

I'm looking for something like "Django Admin", i.e. that will enable quick table based editing in Java and embedded DB (H2 ??) All ieads are welcomed Ilan
eLAN
  • 303
  • 5
  • 13
2
votes
1 answer

Play framework with H2 - need simple tutorial

I configured H2 in application.conf Unhashed this rows: db.default.driver=org.h2.Driver db.default.url="jdbc:h2:file:data/db" db.default.user=sa db.default.password="" Ok, then compile my app, using play run, then play h2-browser in other window…
user2340414
  • 89
  • 1
  • 9
2
votes
0 answers

multi-schema or multi-database in H2, which is better?

For a use case like multi-tenancy support in database, I wanted to know which of the following options fares better in terms of performance and maintainability? same database, different schema (one schema per tenant) different DB instance per…
Aditya G.
  • 119
  • 3
  • 6
2
votes
0 answers

H2 db: how to run a SQL script in the current directory

I'm trying to do this in an arbitrary folder: java -cp .;e:\tools\h2\bin\* org.h2.tools.RunScript -url myDBURI -script CreateDatabase.sql CreateDatabase.sql is in the current folder. Inside it I have: runscript from…
micdev42
  • 87
  • 2
  • 7
2
votes
1 answer

H2 PARSEDATETIME cannot parse yyMMdd format text

I'm trying to load some CSV data: SELECT PARSEDATETIME('TS', 'yyMMdd') as V FROM CSVREAD('E:/sample-data/jmg.asc', 'SYMBOL, TS, HIGH, LOW, OPENING, CLOSING, VOLUME', 'fieldSeparator=,'); My file has one…
micdev42
  • 87
  • 2
  • 7
2
votes
3 answers

How can I locate an embedded h2 db based on my SQuirrel configuration?

I have a simple h2 database example, I assume it is a database that is stored in a single file. But where do I find this file? I'd like to connect to that db using SQL clients like Squirrel. Where is this file placed by default?
membersound
  • 81,582
  • 193
  • 585
  • 1,120