0

Did anyone was able to connect to database using Spring boot, R2DBC and encrypted connection I have a connection string:

jdbc:sqlserver://XXX.XX.XXXX:1433;encrypt=true;trustServerCertificate=true;databaseName=ABC I am using connection factory builder class and parsed arguments as shown below:

public ConnectionFactory connectionFactory() {

final ConnectionFactoryOptions options = builder()
        .option(DRIVER, "sqlserver")
        .option(HOST, applicationDatabaseProperties.getHost())
        .option(PORT, applicationDatabaseProperties.getPort())
        .option(USER, applicationDatabaseProperties.getUsername())
        .option(PASSWORD, applicationDatabaseProperties.getPassword())
        .option(DATABASE, applicationDatabaseProperties.getDatabase())
        .option(SSL, true)
        
        .build()

return ConnectionFactories.get(options);

}

It gives me a runtime SSL error when I am trying to connect

I tried to add an option as shown below - I saw it in the documentation: .option(Option.valueOf("[trustServerCertificate]","[true]"))

but compiler gives the error(using it from Kotlin code), I decompiled original class io.r2dbc.spi.ConnectionFactoryOptions and trustServerCertificate is not listed as a constant

Any help would be greatly appreciated Thanks, Sam

Tried adding the option .option(Option.valueOf("[trustServerCertificate]","[true]")) to the builder, compiler returns the error

SamElp
  • 1
  • 1

0 Answers0