Reputation: 43
I want to obtain a temporary mssql database to execute some tests, currently i am using h2 for the purpose but because it does not support stored procedures i want to start using the test containers, how can i obtain such database through the jdbc url in my application-test.yaml as i do for the h2:
spring:
datasource:
url: jdbc:h2:mem:master;MODE=MSSQLServer;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=FALSE;DB_CLOSE_ON_EXIT=false;CASE_INSENSITIVE_IDENTIFIERS=TRUE;TRACE_LEVEL_SYSTEM_OUT=2;INIT=CREATE SCHEMA IF NOT EXISTS dbo\;SET SCHEMA dbo
I tried to find a solution for this in the https://www.testcontainers.org/modules/databases/jdbc/ documentation but i dont find any for mssql.
Upvotes: 1
Views: 1608
Reputation: 6530
Hostless JDBC url can be used. Using spring boot the following property should be set spring.datasource.url=jdbc:tc:sqlserver:latest:///
. Read more about Testcontainers MSSQL server module.
See an example here
Upvotes: 2