You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Reactive R2dbc连接MsSql遇ConnectionFactory创建失败问题求助

R2DBC连接MS SQL Server的Kerberos认证问题

现状说明

  • 非反应式JDBC方式可正常连接MS SQL Server,配置如下:
spring.datasource.url=jdbc:sqlserver://AAAAA1011.na.app.corp\\bbbb;databaseName=mydb;integratedSecurity=true;authenticationScheme=JavaKerberos
  • 使用Reactive R2DBC方式连接时抛出异常,代码实现:
@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;
}

异常信息

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]

疑问

曾看到2019年的相关问题提及R2DBC不支持Kerberos认证,如今已过去3年,不确定当前版本的R2DBC MS SQL驱动是否已支持该认证方式,希望获得相关解决方案或确认信息。

内容的提问来源于stack exchange,提问作者john

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.10 07:55:25