Şeklen şöyle
OUTPUT içinde kullanılabilir. Şeklen şöyle
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>mssqlserver</artifactId>
<version>1.18.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>11.2.2.jre8</version>
<scope>test</scope>
</dependency>
@Container
private static final MSSQLServerContainer<?> SQLSERVER_CONTAINER =
new MSSQLServerContainer<>("mcr.microsoft.com/mssql/server:2022-latest").acceptLicense();
MSQLServerContainer mssqlserver = new MSSQLServerContainer<>(...).acceptLicense();
MSSQLServerContainer<> container = new MSSQLServerContainer<>("mcr.microsoft.com/mssql/server:2017-CU12"); container.withUrlParam("user", container.getUsername()) .withUrlParam("password", container.getPassword()); container.start(); String jdbcUrl = container.getJdbcUrl();
new MSSQLServerContainer<>("mcr.microsoft.com/mssql/server:2017-latest").withStartupCheckStrategy(new MinimumDurationRunningStartupCheckStrategy(Duration.ofSeconds(5)));
<dependency> <groupId>org.testcontainers</groupId> <artifactId>mssqlserver</artifactId> <version>1.17.6</version> <scope>test</scope> </dependency> <dependency> <groupId>com.microsoft.sqlserver</groupId> <artifactId>mssql-jdbc</artifactId> <version>11.2.2.jre8</version> <scope>test</scope> </dependency>
String jdbcUrl = "jdbc:tc:sqlserver:latest:///mydbName"; try (Connection conn = DriverManager.getConnection(jdbcUrl)) { ... }
String jdbcUrl = "jdbc:tc:sqlserver:2017-CU12:///mydbName"; try (Connection conn = DriverManager.getConnection(jdbcUrl)) { ... }
Giriş UNICODE olmayan normal karakterler İçindir Örnek Şöyle yaparız CREATE TABLE ExampleTable ( ExampleColumn VARCHAR(255) ); INSERT IN...