2

I am integrating DBUnit for unit testing my application, then I came across the issue of the H2 in-memory DB not supporting PLSQL functions to be specified in the SQL script.

So, can anyhone suggest an in-memory database (alternative to H2) that I could integrate with DBUnit and could execute Oracle PL/SQL functions ?

3
  • Have you checked HSQLDB?: hsqldb.org/doc/util-guide/… Commented Mar 23, 2016 at 8:11
  • 4
    The only database that can reliably execute PL/SQL is Oracle. Running a unit test on a database that is different then the production database does not make sense - especially when it comes to stored procedures Commented Mar 23, 2016 at 8:38
  • OK that makes sense.. Do you think I can run DBUnit on the actual Oracle DB and have it rollback changes done by my test case ? Commented Mar 24, 2016 at 11:58

2 Answers 2

1

As mentioned by the second commment, nothing besides Oracle DB will do what Oracle does, in terms of PL/SQL procedures, functions and other features.

So, to use DBUnit, the solution would be a physical Oracle DB that will act just like the H2 in-memory DB. This makes life simple, and works very well.

Sign up to request clarification or add additional context in comments.

Comments

1

I know this post is 7 years old, but if you're anything like me and stumbled upon this issue now, you could try Testcontainers. It's a way to create Docker containers for your tests ad-hoc. They have support for OracleFree and OracleXE modules as well.

One way to sidestep [cloud development] challenges is by relying on in-memory databases, embedded services, mocks, and other fake replicas of the production dependencies. However, these approaches bring their own problems (e.g. In-memory services may not have all the features of your production service and behave slightly differently).

It's pretty straight forward, and you will have an Oracle DB that has all the features of a productive system.

var oracle = new OracleContainer(DockerImageName.parse("gvenzl/oracle-xe:21-slim-faststart"));
oracle.start();

Reference: https://testcontainers.com

2 Comments

Links will be worn out over time. Your post currently translates to "I had this problem too and I found a great solution at [link]". But, if the link will not work at some point, then people will no longer understand what you've meant. Therefore, while your answer is quite welcome, I kindly ask you to edit it and add the most important technical information into the body of your text, so if the link will no longer work (domain change or the like) then your answer will still preserve its meaning. Thanks!
Thanks. I tried to improve my reply to not completely rely on the link.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.