Oracle
Testing
To test using Oracle set the platform to oracle
in
src/test/resources/application-test.yaml
Refer to docs / testing if application-test.yaml doesn't exist yet.
ebean:
test:
platform: oracle # h2, postgres, mysql, oracle, sqlserver
ddlMode: dropCreate # none | dropCreate | migrations
dbName: test
The above will use the following defaults:
The above will use the following defaults:
username: | {databaseName} |
---|---|
password: | test |
port: | 1521 |
url: | jdbc:oracle:thin:@localhost:{port}:XE |
driver: | oracle.jdbc.driver.OracleDriver |
image: | oracleinanutshell/oracle-xe-11g:{version} |
ebean-oracle dependency
We can use the io.ebean:ebean-oracle
dependency rather than io.ebean:ebean
if we want to only
bring in the Oracle database specific platform code. Depending on io.ebean:ebean
will bring in all platforms.
Types
UUID
UUID is not a native Oracle type and can be mapped to either BINARY(16) or VARCHAR(36)..
History support
Oracle has native SQL2011 History support.
Docker container
We can programmatically start a docker container version of Oracle.
The below uses ebean-test-docker
dependency which already comes with ebean-test
.
If we do not have a dependency on ebean-test
then add io.ebean:ebean-test-docker:5.0
as a dependency.
package main;
import io.ebean.docker.commands.OracleContainer;
public class Main {
public static void main(String[] args) {
OracleContainer container = OracleContainer.newBuilder("latest")
.user("my_user")
.build();
container.start();
}
}