Registry / testing / jdbc
library1.21.4javamavenunverified

Testcontainers JDBC provides JDBC URL support for spinning up database containers in tests.

<dependency> <groupId>org.testcontainers</groupId> <artifactId>jdbc</artifactId> <version>1.21.4</version> </dependency>
INSTALL
IMPORT
SIG · JDBC
J
jdbc
testingjavav1.21.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

JdbcDatabaseContainer
org.testcontainers.containers.JdbcDatabaseContainer

Start a PostgreSQL container and get its JDBC URL.

import org.testcontainers.containers.PostgreSQLContainer; public class TestcontainersJDBCExample { public static void main(String[] args) { try (PostgreSQLContainer<?> postgres = new PostgreSQLContainer<>("postgres:15")) { postgres.start(); System.out.println("JDBC URL: " + postgres.getJdbcUrl()); } } }
Debug
Known issues
gotchaTestcontainers requires Docker to be installed and running.
fix
Ensure Docker is available in the test environment.
affects: *
Upgrade
Version history
1.21.4latest on Maven
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
7
Resources
jdbc — mvn dependency:get jdbc · libregistry