diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java index 732f4d068..8ec05469d 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java @@ -359,7 +359,8 @@ public class DB2Dictionary public boolean isDB2UDBV82OrLater() { boolean match = false; - if ((databaseProductVersion.indexOf("SQL") != -1 + if (databaseProductName != null && + (databaseProductVersion.indexOf("SQL") != -1 || databaseProductName.indexOf("DB2/") != -1) && ((maj == 8 && min >= 2) || (maj >= 9))) match = true; @@ -368,7 +369,8 @@ public class DB2Dictionary public boolean isDB2ZOSV8xOrLater() { boolean match = false; - if ((databaseProductVersion.indexOf("DSN") != -1 + if (databaseProductName != null && + (databaseProductVersion.indexOf("DSN") != -1 || databaseProductName.indexOf("DB2/") == -1) && maj >= 8) match = true; @@ -377,7 +379,8 @@ public class DB2Dictionary public boolean isDB2ISeriesV5R3OrEarlier() { boolean match = false; - if (databaseProductName.indexOf("AS") != -1 + if (databaseProductName != null && + databaseProductName.indexOf("AS") != -1 && ((maj == 5 && min <=3) || maj < 5)) match = true; return match; @@ -385,7 +388,8 @@ public class DB2Dictionary public boolean isDB2ISeriesV5R4OrLater() { boolean match = false; - if (databaseProductName.indexOf("AS") != -1 + if (databaseProductName != null && + databaseProductName.indexOf("AS") != -1 && (maj >=6 || (maj == 5 && min >=4))) match = true; return match; @@ -393,9 +397,10 @@ public class DB2Dictionary public boolean isDB2UDBV81OrEarlier() { boolean match = false; - if ((databaseProductVersion.indexOf("SQL") != -1 - || databaseProductName.indexOf("DB2/") != -1) && - ((maj == 8 && min <= 1) || maj < 8)) + if (databaseProductName != null && + (databaseProductVersion.indexOf("SQL") != -1 + || databaseProductName.indexOf("DB2/") != -1) && + ((maj == 8 && min <= 1) || maj < 8)) match = true; return match; }