HHH-14289 Detection of JDBC support for RefCursors was returning false even for Oracle JDBC drivers supporting it

This commit is contained in:
Sanne Grinovero 2020-10-26 17:12:57 +00:00
parent ded7fb5814
commit 6745dff121
1 changed files with 10 additions and 2 deletions

View File

@ -137,9 +137,17 @@ public class StandardRefCursorSupport implements RefCursorSupport {
*/
public static boolean supportsRefCursors(DatabaseMetaData meta) {
try {
return meta.supportsRefCursors();
final boolean mightSupportIt = meta.supportsRefCursors();
// Some databases cheat and don't actually support it correctly: add some additional checks.
if ( mightSupportIt ) {
if ( "Oracle JDBC driver".equals( meta.getDriverName() ) && meta.getDriverMajorVersion() < 19 ) {
return false;
}
catch (SQLException throwable) {
}
return mightSupportIt;
}
catch (Exception throwable) {
//If the driver is not compatible with the Java 8 contract, the method might not exit.
log.debug( "Unexpected error trying to gauge level of JDBC REF_CURSOR support : " + throwable.getMessage() );
return false;
}