0

When I tried with non-reactive approach as below, am able to get connection without any issues.

spring.datasource.url=jdbc:sqlserver://AAAAA1011.na.app.corp\\bbbb;databaseName=mydb;integratedSecurity=true;authenticationScheme=JavaKerberos

But when I tried with Reactive R2dbc with MsSql server approach as below, then am facing exceptions, below is the code:

@Bean
@Override
public ConnectionFactory connectionFactory() {

    ConnectionFactory connectionFactory = ConnectionFactories.get(ConnectionFactoryOptions.builder()
            .option(ConnectionFactoryOptions.DRIVER, "mssql")
            .option(ConnectionFactoryOptions.HOST, "AAAAA1011.na.app.corp/bbbb")
            .option(ConnectionFactoryOptions.DATABASE, "mydb")
            .option(ConnectionFactoryOptions.USER, "NA\\user")
            .option(Option.valueOf("integratedSecurity"), true)
            .option(Option.valueOf("authenticationScheme"), "JavaKerberos")
            .build());


    return connectionFactory;
}`

Excception stacktrace:

 org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.r2dbc.spi.ConnectionFactory]: Factory method 'connectionFactory' threw exception; nested exception is java.lang.IllegalStateException: Unable to create a ConnectionFactory for 'ConnectionFactoryOptions{options={database=mydb, host=AAAAA1011.na.app.corp/bbbb, driver=mssql, authenticationScheme=JavaKerberos, integratedSecurity=true, user=NA\user}}'. Available drivers: [ pool, sqlserver ]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658) ~[spring-beans-5.3.23.jar:5.3.23]

And I found this link too: https://github.com/r2dbc/r2dbc-mssql/issues/101 , mentioning that r2dbc doesnt support Kerberos seems, but that was written on 2019, its been 3 yrs now, not sure whether above works or not.

If anyone aware of above issue, can you Please help me out..

M. Deinum
  • 115,695
  • 22
  • 220
  • 224
john
  • 1

1 Answers1

0

From the exception info, the connection issue is caused by the driver settings.

Available drivers: [ pool, sqlserver ]

Try to change .option(ConnectionFactoryOptions.DRIVER, "mssql") to the following:

.option(ConnectionFactoryOptions.DRIVER, "sqlserver")

I know little about Kerberos support in R2dbc/MSSQL, please update yourself according to the official docs.

Hantsy
  • 8,006
  • 7
  • 64
  • 109