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

H2 database will not run on Opensuse 12.2

I'm trying to use h2 database on opensuse, but I can't make it work. I downloaded the platform independent package from the official web site, then tried several things to run it, without success : Make the /h2/bin/h2.sh executable, then execute…
Saffron
  • 682
  • 6
  • 14
2
votes
0 answers

update query that works in both MYSQL and H2

I think I have queries for mysql and h2 that both work but can anyone come up with one that works on both? The table has a foreign key to its own primary key and I want to copy a field value down the heirarchy. The mysql query looks like…
Julian
  • 1,522
  • 11
  • 26
2
votes
1 answer

CSV to H2 - character encoding missmatch

In my app, I: let Hibernate create H2 DB populate DB through JDBC SQL statement with CSV import (INSERT INTO ... SELECT ... FROM CSVREAD(file.csv)). File is in UTF-8 encoding. On Linux special characters in the DB are correct. On Windows (default…
dunadan
  • 21
  • 1
  • 3
2
votes
2 answers

select column name from H2 with columns that have spaces

I am attempting to query from a tab delimited file with H2 and java. When I select * there are no problems, however, one of the columns has a space in the column name. When I try to query on just that column I get an exception: Caused by:…
javamonkey79
  • 17,443
  • 36
  • 114
  • 172
2
votes
1 answer

Cannot create table in test (Hibernate & H2)

I have an image mapping table that maps images to the various items that have images. This works as expected when I make the entries in the database by hand, and am retrieving, however when I try to do tests they fail with the below errors. I am…
zmanc
  • 5,201
  • 12
  • 45
  • 90
2
votes
1 answer

H2: "data conversion error" in WHERE clause

I am using the H2 database (v1.3.170) for JUnit testing in my project. Our production environment uses Oracle DB so we have to do lot conversions of the DDLs exported from Oracle to make them working with H2. One of the issues we are facing right…
2
votes
4 answers

H2 database. How to convert date to seconds in sql?

Is there analog og the MySQL's time_to_sec() ? I heed to perform query like the following on H2 database: select * from order join timmingSettings on order.timmingSettings = timmingSettings.id where (order.time-timmingSettings.timeout) <…
Max
  • 2,293
  • 5
  • 32
  • 48
2
votes
2 answers

H2 DB CSVREAD command converting value to date before placing into VARCHAR

I am attempting to load a tab delimited text file which contains a column of values which happen to look exactly like a date, but aren't. It appears that the CSVREAD command scans the row, converts the text value in the column to a java.Sql.Date,…
chaotic3quilibrium
  • 5,661
  • 8
  • 53
  • 86
2
votes
1 answer

How to read/write H2 embedded DB to a file inside your JAR?

I have an Eclipse project that is organized as follows: MyProj/ src/ main/ java/ config/ spring/ spring-config.xml …
IAmYourFaja
  • 55,468
  • 181
  • 466
  • 756
2
votes
1 answer

H2 Order by on multiple columns with limit behaviour

Is it normal that the output varies when using multiple ordering columns and the order of those columns are varied? For instance: create table test_table ( id int8 not null, year int4 not null, province varchar(16) not null, …
flume
  • 21
  • 1
  • 3
2
votes
1 answer

Select independent distinct with one query

I need to select distinct values from multiple columns in an h2 database so I can have a list of suggestions for the user based on what is in the database. In other words, I need something like SELECT DISTINCT a FROM table SELECT DISTINCT b FROM…
BrainStorm.exe
  • 1,565
  • 3
  • 23
  • 40
2
votes
3 answers

Play2 and Scala, How should I configure my integration tests to run with proper DB

I'm trying to figure out how to write my db integration tests in my Play2 app. In my conf file I have specified two databases, xxx_test for regular use and h2 db for…
jakob
  • 5,979
  • 7
  • 64
  • 103
2
votes
1 answer

H2 DB CSVWRITE Duplicate Double Quotes Inside a String

I was trying to export a table in H2 DB into CSV using CSVWRITE function and found out if double quotes are included in a varchar column they will be duplicated. Eg. - 'hello"howareyou' will be 'hello""howareyou' in the written csv. Tried saving…
Akalanka
  • 310
  • 5
  • 12
2
votes
0 answers

How do I cure "org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected end of subtree"?

I'm using Hibernate 4.1.0.Final, JPA 2.0, JUnit 4.8.1, and the H2 in-memory database. I have this JPA query ... @Override public List findByOrgTypesCountryAndState(final List organizationTypes, …
Dave
  • 15,639
  • 133
  • 442
  • 830
2
votes
1 answer

H2 database WebServer session timeout

How can I change the session length of the H2 database WebServer? I'm using it only for development on my local machine and the default 30 minutes session length is too short as it often times out.