【Kingbase8数据库】springboot jpa集成Kingbase8各种报错

Access to DialectResolutionInfo cannot be null when ‘hibernate.dialect’ not set

去了stackoverflow: java - Spring Boot JPA - Access to DialectResolutionInfo cannot be null when ‘hibernate.dialect’ not set - Stack Overflow 不是PostgreSQL,那就换成mysql的嘛:

spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.Kingbase8Dialect

Could not load requested class : org.hibernate.dialect.Kingbase8Dialect

增加方言类: class Kingbase8Dialect extends PostgreSQL9Dialect

    @Override
    public IdentifierHelper buildIdentifierHelper(IdentifierHelperBuilder builder, DatabaseMetaData dbMetaData)
            throws SQLException {

        if (dbMetaData == null) {
            builder.setQuotedCaseStrategy(IdentifierCaseStrategy.MIXED);
        }
        builder.applyIdentifierCasing( dbMetaData );

        builder.applyReservedWords( dbMetaData );
        builder.applyReservedWords( AnsiSqlKeywords.INSTANCE.sql2003() );
        builder.applyReservedWords(super.getKeywords());

        builder.setNameQualifierSupport( getNameQualifierSupport() );
        builder.setUnquotedCaseStrategy(IdentifierCaseStrategy.MIXED);
        return builder.build();

Caused by: java.lang.RuntimeException: Driver org.postgresql.Driver claims to not accept jdbcUrl, jdbc:kingbase8:

增加配置: spring.datasource.ddb.driver-class-name=com.kingbase8.Driver

couldn’t deduct database type from database product name ‘KingbaseES’

posted @ 2024-03-30 08:05  木头左  阅读(360)  评论(0编辑  收藏  举报