ibmdb / java_reactive_driver

IBM Db2 Java Reactive Driver based on R2DBC.
6 stars 1 forks source link

R2dbc cannot determine a dialect to use #10

Open RogierWV opened 9 months ago

RogierWV commented 9 months ago
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'r2dbcDatabaseClient' defined in class path resource [io/snynx/namegengrpcserver/configuration/R2DBCConfig.class]: Failed to instantiate [org.springframework.r2dbc.core.DatabaseClient]: Factory method 'databaseClient' threw exception with message: Cannot determine a dialect for IBM-DB2 using com.ibm.db2.r2dbc.DB2ConnectionFactory@2ba1bc43; Please provide a Dialect
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.r2dbc.core.DatabaseClient]: Factory method 'databaseClient' threw exception with message: Cannot determine a dialect for IBM-DB2 using com.ibm.db2.r2dbc.DB2ConnectionFactory@2ba1bc43; Please provide a Dialect
Caused by: org.springframework.data.r2dbc.dialect.DialectResolver$NoDialectException: Cannot determine a dialect for IBM-DB2 using com.ibm.db2.r2dbc.DB2ConnectionFactory@2ba1bc43; Please provide a Dialect

Expected result of this would be a started connection, instead it fails to instantiate a bean for the factory.

Code in use is the following:

@Configuration
@EnableR2dbcRepositories
@Slf4j
public class R2DBCConfig extends AbstractR2dbcConfiguration {
    @Override
    @Bean
    @NonNull
    public ConnectionFactory connectionFactory() {
        final String database = "namer";
        final String host = "db2server";
        final int port = 50000;
        final String username = "db2inst1";
        final String password = "";
        DB2ConnectionConfiguration conf = DB2ConnectionConfiguration.builder()
                .database(database)
                .host(host)
                .port(port)
                .username(username)
                .password(password)
                .build();
        return new DB2ConnectionFactory(conf);
    }
}
mp911de commented 9 months ago

Spring Data R2DBC hasn't integrated the driver yet as the driver doesn't work yet properly. Last time, it didn't pass the R2DBC TCK.

See also https://github.com/spring-projects/spring-data-relational/issues/1555.