Skip to content

Commit 3cac9d1

Browse files
committed
Updating Oracle version to Oracle Free 23.
The new image is configured as compatible with the old image, which it actually isn't. The default database names are different, so we also set a database name that is different both from the one used by TestContainers as default and the one used by the Docker image. If the TestContainers default is used the database is not found, because the image just creates the default one and the name doesn't mach. If the Docker image default is used, the image creates its default database and then tries to create it again, which fails. These workarounds may be removed once TestContainers properly supports the new image. Closing #1528
1 parent 121317f commit 3cac9d1

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

spring-data-jdbc/src/test/java/org/springframework/data/jdbc/testing/OracleDataSourceConfiguration.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.springframework.jdbc.datasource.DriverManagerDataSource;
2626
import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
2727
import org.testcontainers.containers.OracleContainer;
28+
import org.testcontainers.utility.DockerImageName;
2829

2930
/**
3031
* {@link DataSource} setup for Oracle Database XE. Starts a docker container with an Oracle database.
@@ -50,7 +51,11 @@ protected DataSource createDataSource() {
5051
if (ORACLE_CONTAINER == null) {
5152

5253
LOG.info("Oracle starting...");
53-
OracleContainer container = new OracleContainer("gvenzl/oracle-xe:21.3.0-slim").withReuse(true);
54+
DockerImageName dockerImageName = DockerImageName.parse("gvenzl/oracle-free:23-slim")
55+
.asCompatibleSubstituteFor("gvenzl/oracle-xe");
56+
OracleContainer container = new OracleContainer(dockerImageName)
57+
.withDatabaseName("freepdb2")
58+
.withReuse(true);
5459
container.start();
5560
LOG.info("Oracle started");
5661

spring-data-relational/src/test/java/org/springframework/data/ProxyImageNameSubstitutor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class ProxyImageNameSubstitutor extends ImageNameSubstitutor {
3333
private static final Logger LOG = LoggerFactory.getLogger(ProxyImageNameSubstitutor.class);
3434

3535
private static final List<String> NAMES_TO_PROXY_PREFIX = List.of("ryuk", "arm64v8/mariadb", "ibmcom/db2",
36-
"gvenzl/oracle-xe");
36+
"gvenzl/oracle-free");
3737

3838
private static final List<String> NAMES_TO_LIBRARY_PROXY_PREFIX = List.of("mariadb", "mysql", "postgres");
3939

0 commit comments

Comments
 (0)