Embedded or managed Oracle instance for integration tests

坚强是说给别人听的谎言 提交于 2019-12-11 01:37:59

问题


For MySQL, the MXJ connector makes it very easy to launch a managed MySQL instance.

I know that Oracle provides Oracle XE for quick setup, but I've only found an RPM distribution that needs to be installed. Is there a neatly packaged jar that I can just drop in the classpath and start up by calling a specific JDBC url, a la HSQLDB or MXJ?

I'm interested in having developers use this locally for running tests, as well as on our continuous integration server.


回答1:


The short answer is No. Oracle is a big meaty chunk of database. Amongst other things, it generally expects itself to be run by its own special user rather than the client user.

For simplicity, your best bet is a separate DB server with each of your developers having their own username/password (and hence their own independent schema) in the database.




回答2:


Although Oracle does not provide an embedded database, spinning up a local Docker container running Oracle XE might be an ideal way to accommodate Oracle-specific local integration tests. Since Docker containers are ephemeral in nature by design, the database could also be completely torn down as desired providing clean sandboxing.

The alexeiled/docker-oracle-xe-11g image on DockerHub I found has particularly clear setup and documentation instructions: https://hub.docker.com/r/alexeiled/docker-oracle-xe-11g/

After spinning up the Docker container, be sure to:

  • First connect to the APEX web console, login, as per the instructions
  • Then open Oracle SQL Developer and select Reset Password... first. Otherwise the following error may be thrown java.lang.ArithmeticException when attempting to get connection in Oracle 11.2.0.2.0 (64 bit)

As the documentation describes, the docker run command can also be designed to automatically run SQL scripts on the container's startup, which could also be very valuable in the CI/integration testing workflow.

Hope this helps!



来源:https://stackoverflow.com/questions/6491656/embedded-or-managed-oracle-instance-for-integration-tests

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!