From c153c3bfdcd0eeb37ff8b8683f309b443e258f65 Mon Sep 17 00:00:00 2001 From: Mihhail Lapushkin Date: Thu, 2 Mar 2017 15:37:02 +0200 Subject: [PATCH 1/2] Note about JDBC driver For me it did not work with Spring Boot until I changed the driver: spring.datasource.driver-class-name=org.testcontainers.jdbc.ContainerDatabaseDriver Not sure if this is needed in general. --- docs/usage/database_containers.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/usage/database_containers.md b/docs/usage/database_containers.md index e1ef557a595..7775e5c26f4 100644 --- a/docs/usage/database_containers.md +++ b/docs/usage/database_containers.md @@ -48,8 +48,8 @@ Examples/Tests: ### JDBC URL As long as you have TestContainers and the appropriate JDBC driver on your classpath, you can simply modify regular JDBC connection URLs to get a fresh containerized instance of the database each time your application starts up. - -_N.B: TC needs to be on your application's classpath at runtime for this to work_ +* _TC needs to be on your application's classpath at runtime for this to work_ +* _JDBC driver needs to be set to `org.testcontainers.jdbc.ContainerDatabaseDriver`_ **Original URL**: `jdbc:mysql://somehostname:someport/databasename` @@ -112,4 +112,4 @@ and will be able to override server settings when the container starts. VirtuosoContainer provides access to the SPARQL service URL ```java String sparqlServiceUrl = ((VirtuosoContainer)container).getSparqlUrl(); -``` \ No newline at end of file +``` From d695bf71a2daf7df6064bd6f10c815c1ddf64dea Mon Sep 17 00:00:00 2001 From: Mihhail Lapushkin Date: Thu, 2 Mar 2017 16:01:07 +0200 Subject: [PATCH 2/2] Seems like Spring Boot issue --- docs/usage/database_containers.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/usage/database_containers.md b/docs/usage/database_containers.md index 7775e5c26f4..9da5af91e81 100644 --- a/docs/usage/database_containers.md +++ b/docs/usage/database_containers.md @@ -48,8 +48,10 @@ Examples/Tests: ### JDBC URL As long as you have TestContainers and the appropriate JDBC driver on your classpath, you can simply modify regular JDBC connection URLs to get a fresh containerized instance of the database each time your application starts up. + +_N.B:_ * _TC needs to be on your application's classpath at runtime for this to work_ -* _JDBC driver needs to be set to `org.testcontainers.jdbc.ContainerDatabaseDriver`_ +* _For Spring Boot you need to specify the driver manually `spring.datasource.driver-class-name=org.testcontainers.jdbc.ContainerDatabaseDriver`_ **Original URL**: `jdbc:mysql://somehostname:someport/databasename`