I am currently using DB2 to do unit tests, but it is sometime quite slow. I would need a good in-memory database that would include all the feature of DB2. Does this type of in-memory database exist, or do they only allow standard SQL feature?
Thank you.
EDIT The DB2 Database is on a remote server, so I would need a solution to replicate the schema of that database on a local in-memory database to speed up the tests.
If you make your bufferpool large enough, your DB2 database will be in-memory, too.
Derby (ex Cloudscape) is DB2's language compatible. And it has an in memory mode.
Maybe also have a look at H2 (with the DB2 compatibility mode). But even if H2 would be faster, I would consider Derby in your case.
Having no idea what features DB2 has, but sqlite can create in-memory database. You might want to take a look at it.
As mentioned by Pascal, Derby is almost identical syntactically to DB2. Having tried it for the same thing a while back we had an issue with Derby not supporting sequences, but the connection protocols are identical. Eg you can use the DB2 JDBC driver to connect to a Derby database.
If your application abstracts your database connection with say Hibernate, or NHibernate (if .Net) using H2 or HSQLDB could also work for unit tests assuming you aren't relying on stored procedures and the like.
Another tool that helps out with schema migration that targets multiple DBs is http://liquibase.org . For a test build you make it build your in memory DB and for a deployment you make it build your DB2 database or generate the migration script. It will build the database with the correct schema and offers conditional migrations (eg grant is not available in HSQL so you run the change set for just DB2).
Two possible in-memory databases are: - timesTen from Oracle. - SolidDB from IBM. This one could send the transaction back to DB2, but the queries will have a really high performance
For more information about soliddb http://www-01.ibm.com/software/data/soliddb/
Why not to use tmpfs (Unix), or any conventional ramdrive solution for Windows? Or, you can get a fast SSD.