Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

H2 in memory db or PostgreSQL for unit testing?

843859Sep 10 2008 — edited Jan 20 2015
Hi,

I'm creating some unit tests and set up an H2 in memory database. Part of the set up executes the DDL scripts used to create and upgrade the database. My problem is that there is some syntax not supported by H2. So far I've found that I can't specify DEFAULT nextval('sequence_name') on a column in CREATE TABLE, and some limitations on CREATE ROLE. H2 supports "identity" data type for auto incrementing, but PostgreSQL calls it bigserial.

Some ideas I have about this:

1) Maintain separate DDL scripts for my test environment. They will be almost duplicates of production DDL, with tweaks to work in H2.
2) Get rid of H2 in memory database, and run all the scripts in a real PostgreSQL server. Before starting the tests clear out all tables, sequences, users, etc. then rebuild the DB. I'll need to make sure that there is never more than one system executing tests on the same postgres server at the same time. Perhaps developers will configure their systems to execute tests on a local postgres server, and our CI server will be configured to execute tests on it's own local postgres server.

What do you guys do?


Thanks,
Ryan
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 10 2008
Added on Sep 10 2008
1 comment
1,112 views