h2

h2 (embedded mode ) database files problem

There is a h2-database file in my src directory (Java, Eclipse): h2test.db The problem: starting the h2.jar from the command line (and thus the h2 browser interface on port 8082), I have created 2 tables, 'test1' and 'test2' in h2test.db and I have put some data in them; when trying to access them from java code (JDBC), it throws me "...

"Create table if not exists" - how to check the schema, too?

Is there a (more or less) standard way to check not only whether a table named mytable exists, but also whether its schema is similar to what it should be? I'm experimenting with H2 database, and CREATE TABLE IF NOT EXISTS mytable (....) statements apparently only check for the table´s name. I would expect to get an exception if there...

Relational Database arrays (H2, Java)

I seem to have two options on how to implement arrays, and I want to know which I should go with: Use the ARRAY data type and (from what I understand) effectively serialize data objects into the database (which in my case are just wrapped primitive types; don't know of another way to make this work). Use a separate table and map with f...

insert a BLOB via a sql script ?

Hi, I have an H2 database (http://www.h2database.com) and I'd like to insert a file into a BLOB field via a plain simple sql script (to populate a test database for instance). I know how to do that via the code but I cannot find how to do the sql script itself. I tried to pass the path , i.e. INSERT INTO mytable (id,name,file) VALUE...

SQL (Java, h2): What's the best way to retrieve the unique ID of the single item I just inserted into my database?

My current method is this: SELECT TOP 1 ID FROM DATAENTRY ORDER BY ID DESC This assumes the latest inserted item always has the highest unique ID (primary key, autoincrementing). Something smells wrong here. Alternatives? ...

How to get stream to "in-memory" database created via H2DB?

I have to create such a mechanism: Create in-memory (H2DB) database; Create tables and fill them using some data; Get stream to that database; Send that stream via WebDAV or something else; I know everything except that "How to get stream to "in-memory" database created via H2DB"? And some explanations: I can't create file becau...

Which is better H2 or HSQLDB?

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 MVCC on H2 is still experimental. With regards to support/documentation, concurrency, performance, which is better between the two? ...

[netbeans] inlcude H2 database to use netbeans GUI with it

Hi all, is possible include H2 database in netbeans to use it with the GUI to create table ecc ecc? Like javadb integration i means.. ...

What are the best settings of the H2 database for high concurrency?

There are a lot of settings that can be used in H2 database. AUTO_SERVER, MVCC, LOCK_MODE, FILE_LOCK and MULTI_THREADED. I wonder what combination works best for high concurrency setup e.g. one thread is doing INSERTs and another connection does some UPDATEs and SELECTs? I tried MVCC=TRUE;LOCK_MODE=3lFILE_LOCK=NO but whenever I do some ...

[H2 and Firebird]auto_increment, identity or trigger plus generator?

Hi all, in Firebird the only way to have an auto increment coloumn is to setup a generator and use it with a trigger. In H2 db there are auto_increment and identity keywords to do it. What is the best way? Mysql use auto_increment too, but there is some problems with cuncurrence read and table lock, isn't true? Thank you. ...

[H2 database] Frontends tool to manage H2 database

Hi all, what's the best frontend tool to manage H2 database? Create table, alter table, add coloumn ecc ecc.. Thanks. ...

h2 in-memory tables, remote connection

I am having problems with creating an in memory table, using H2 database, and accessing it outside of the JVM it is created and running in. The documentation structures the url as jdbc:h2:tcp://<host>/mem:<databasename> I've tried many combinations, but simply cannot get the remote connection to work. Is this feature working, can anyon...

[BDE paradox] Read paradox DBF files and import in H2 database

Hi all, can i import DBF files (i think it is files of paradox database) into H2 database? I think a good solution is to write a small wrapper in java to read dbf data and save in h2 database, there is a jdbc driver to use paradox with java? Thank you. ...

The CHOICE : Firebird or H2

Hi, i have to choice a database to use in server-mode for a java desktop application. I think both are great java database. In my opinion (im NOT well-informed): H2 PRO Is java based Develeopment say it is very very fast Easy to install, configure and use with java application H2 CONS Is a young project Reliability doubt for co...

Setting database-agnostic default column timestamp using Hibernate

I'm working on a java project full of Hibernate (3.3.1) mapping files that have the following sort of declaration for most domain objects. <property name="dateCreated" generated="insert"> <column name="date_created" default="getdate()" /> </property> The problem here is that getdate() is an MSSQL specific function, and when I...

How to create stored procedure using H2 database?

Has anyone tried to create stored procedures using the H2 database? ...

SQL query for selecting only first occurrences of rows with same data in the first column

Is there a neat SQL query that would return rows so that only first occurrences of rows, that have same data in the first column, would be returned? That is, if I have rows like blah something blah somethingelse foo blah bar blah foo hello the query should give me the first, third and fourth rows (because first row is the first occurr...

question for h2 which is faster?

now I have two choice. I have the same schema for all the data. the record stand for the connection between to hosts.So one record belongs to two hosts. now I do the action that once I need to get the connection of 1 host. I will insert the record in to h2. So if there is a connection between host1 and host2. Everytime I query the conne...

slow query log analyzers

What kind of tools are available to read & interpret slow queries and missing indexes? I am aware of MySQL Query Analyzer, can you suggest other tools which are simpler to configure and maintain (both open source and commercial) Database environment: MySQL, H2 ...

H2 database and functions in separate schemas

Hi I'm trying to create a test database (with H2 database). I'm using Oracle in production, and it seems nice to have oracle compatibility mode in h2. However I've got a problem with translating oracle construction: create or replace PACKAGE permission_tools IS FUNCTION get_role_access_level( p_role_id IN NUMBER, ...