I'm working in a project which is using DB2 + myBatis. Currently I'm defining a concept for test automation and I consider using Java DB (former apache derby) as in memomy db for unit tests. Does anyone have experience with this? Does Java DB can be used as a kind of substitution of DB2? From what I could see it's using same dialect as DB2, but that's not enough of course
-
As a rule of thumb I'd say, you should test systems with the same technology you'll use in production. That does not mean that parts of the tests can use mock objects.miku– miku2013-10-29 16:15:54 +00:00Commented Oct 29, 2013 at 16:15
-
I wanted to use this DB in developer's env. Just trying to find a best solution for the problem when many developers run unit tests in the same time. So the concept is to use this db in developer's setup and to use DB2 in continues integration.czajek– czajek2013-10-29 16:26:52 +00:00Commented Oct 29, 2013 at 16:26
-
Using an in-memory DB for unit tests on the developer box is a great idea. For a build-server/continuous integration environment, you're probably going to want to use an actual deployed instance of the destination server, though. Note that no in-memory server I've used has perfectly duplicated all features I've tried to use in DB2, even sticking to just standard features, so there will be times you'll need to have a local server deployed on developer machines.Clockwork-Muse– Clockwork-Muse2013-10-30 12:32:07 +00:00Commented Oct 30, 2013 at 12:32
-
SQL in Java DB should be very close to DB2, because JavaDB comes from Apache Derby, which comes from IBM Cloudscape. And IBM Cloudscape had many similar things with DB2 (both from IBM), and for standard SQL could be a replacement. At the time, DB2 clients (odbc/jdbc) could access Derby databases.AngocA– AngocA2013-10-30 15:42:36 +00:00Commented Oct 30, 2013 at 15:42
-
Hi guys, thanks for your answers. I just wonder how do you maintain a schema in such scenario, since DB2 may contain a lot of schema features that are not supported by JAVA DB. The last thing I want to have is to maintain a dedicated schema for test DB.czajek– czajek2013-10-31 12:51:09 +00:00Commented Oct 31, 2013 at 12:51
Add a comment
|
1 Answer
I've tried this, see this question, which I had when trying to introduce integration tests using Derby for a legacy database that used DB2. How well using Java DB in place of DB2 will depend on how much DB2-specific SQL and DDL you need to support.
If you want a version of DB2 you can install on a developer machine, you could try IBM DB2 Express-C, it's a no-charge version of DB2 you can use locally.
2 Comments
Clockwork-Muse
Hmm, about the biggest issue I ended up having with Derby was that it couldn't do CTEs (which eliminates an entire class of queries). I was told there were some random issues with stored procedures, but don't know for sure myself.
eis
Note that Derby (or other in-mem databases I know) don't really support stored procedures either. That's been the biggest drawback for us.