Is there a good in-memory database that would act

2019-02-16 12:03发布

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.

7条回答
冷血范
2楼-- · 2019-02-16 12:36

If you make your bufferpool large enough, your DB2 database will be in-memory, too.

查看更多
劳资没心,怎么记你
3楼-- · 2019-02-16 12:46

I would need a good in-memory database that would include all the feature of DB2.

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.

查看更多
仙女界的扛把子
4楼-- · 2019-02-16 12:48

Having no idea what features DB2 has, but sqlite can create in-memory database. You might want to take a look at it.

查看更多
Luminary・发光体
5楼-- · 2019-02-16 12:51

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).

查看更多
家丑人穷心不美
6楼-- · 2019-02-16 12:53

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/

查看更多
来,给爷笑一个
7楼-- · 2019-02-16 12:57

Why not to use tmpfs (Unix), or any conventional ramdrive solution for Windows? Or, you can get a fast SSD.

查看更多
登录 后发表回答