发现spring使用OB驱动版本由2.2.7.2升级为2.4.13后,发现启动失败,
跟踪代码发现是
com.oceanbase.jdbc.JDBC4DatabaseMetaData.getDatabaseProductName()方法返回不同造成的
2.4.13
public String getDatabaseProductName() throws SQLException {
if (this.connection.getProtocol().getOptions().useCompatibleMetadata) {
return this.protocol.isOracleMode() ? “Oracle” : “MySQL”;
} else {
return “OceanBase”;
}
}
2.2.7.2
public String getDatabaseProductName() throws SQLException {
return this.connection.getProtocol().isOracleMode() ? “Oracle” : “MySQL”;
}
2.2.7.2返回的是oracle,2.4.13返回的是OceanBase
而oceanbase不在spring的org.springframework.boot.jdbc.DatabaseDriver的枚举中,被识别为UNKNOWN,导致报错。
请问是否能通过配置让这个com.oceanbase.jdbc.JDBC4DatabaseMetaData.getDatabaseProductName()方法,继续返回的是oracle而不是OceanBase