Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

name testcontainers
description Java Testcontainers samples for running Oracle AI Database Free in integration tests.
tags
Database
Java
Testcontainers
oraclefree
blog_post https://andersswanson.dev/2025/05/29/easily-test-oracle-database-applications-with-testcontainers/

Oracle AI Database Testcontainers

This module provides examples using Testcontainers with Oracle AI Database Free to test Java applications using disposable containers.

The gvenzl/oracle-free Oracle AI Database container images are recommended for use with Testcontainers and Java. The examples in this module use the Oracle AI Database 26ai Free image gvenzl/oracle-free:23.26.3-slim-faststart.

Official Oracle Container Registry image

Use the OracleFree Testcontainer to test with the official Oracle Container Registry image. The guide includes a quick start, application-user setup, initialization scripts, admin connections, and configuration options.

Related Blog Posts

This test implements a basic Oracle AI Database test with Testcontainers. The version of the containerized database is queried to verify the test connection works.

This test demonstrates how to run an initialization script in the containerized database to configure a table schema and insert test data.

This test uses a containerized database as a Spring Boot datasource within the context of a @SpringBootTest, initializing the Spring Boot datasource properties at test startup.

The pattern shown allows developers to test their Spring Boot applications with Oracle AI Database using a fully featured Spring context.

This test demonstrates how to mount a SQL script on a containerized database and run that script as sysdba before the test suite begins. This pattern is useful for DBA-level setup before the test, like applying user grants or creating PDBs.

The SysdbaInitTest setup script applies grants to a test user to manage Oracle AI Database Transacational Event Queues (JMS), and then creates a JMS queue.

This test configures a local Oracle AI Database Free container to use the DBMS_CLOUD family PL/SQL packages, enabling the Select AI feature in local tests.

The test uses the OCI GenAI service, and requires an OCI identity configured in ~/.oci, as well as the OCI_COMPARTMENT_ID environment variable set.

This package provides sample tests with a reusable Oracle AI Database container, allowing you to reduce startup time between database test suites.