Skip to content

Commit

Permalink
Use lowercase sa for SQL Server username
Browse files Browse the repository at this point in the history
Otherwise the selected collation might cause issues.
  • Loading branch information
gsmet committed Jun 22, 2023
1 parent a9959f6 commit 58c3748
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ public class MSSQLDevServicesProcessor {

private static final Logger LOG = Logger.getLogger(MSSQLDevServicesProcessor.class);

/**
* Using SA doesn't work with all collations so let's use the lowercase version instead.
*/
private static final String DEFAULT_USERNAME = "sa";

@BuildStep
DevServicesDatasourceProviderBuildItem setupMSSQL(
List<DevServicesSharedNetworkBuildItem> devServicesSharedNetworkBuildItem) {
Expand Down Expand Up @@ -63,7 +68,7 @@ public RunningDevServicesDatasource startDatabase(Optional<String> username, Opt
return new RunningDevServicesDatasource(container.getContainerId(),
container.getEffectiveJdbcUrl(),
container.getReactiveUrl(),
container.getUsername(),
DEFAULT_USERNAME,
container.getPassword(),
new ContainerShutdownCloseable(container, "Microsoft SQL Server"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class DevServicesMsSQLDatasourceTestCase {
public void testDatasource() throws Exception {
AgroalConnectionPoolConfiguration configuration = dataSource.getConfiguration().connectionPoolConfiguration();
assertTrue(configuration.connectionFactoryConfiguration().jdbcUrl().contains("jdbc:sqlserver:"));
assertEquals("SA", configuration.connectionFactoryConfiguration().principal().getName());
assertEquals("sa", configuration.connectionFactoryConfiguration().principal().getName());
assertEquals(20, configuration.maxSize());
assertThat(configuration.exceptionSorter()).isInstanceOf(MSSQLExceptionSorter.class);

Expand Down

0 comments on commit 58c3748

Please sign in to comment.