OPENJPA-644 Handle databaseProductVersion string from newer jcc driver for DB2 ISeries

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@672008 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Catalina Wei 2008-06-26 19:38:30 +00:00
parent 82e61ba0d5
commit e3dbdac159
1 changed files with 32 additions and 10 deletions

View File

@ -438,9 +438,14 @@ public class DB2Dictionary
// (Toolbox)DBProdVersion 05.04.0000 V5R4m0 // (Toolbox)DBProdVersion 05.04.0000 V5R4m0
// ISeries DB2 UDB for AS/400 // ISeries DB2 UDB for AS/400
// (Native) V5R4M0 // (Native) V5R4M0
// new jcc DBProdVersion QSQ05040 or QSQ06010
if (databaseProductName.indexOf("AS") != -1) { if (databaseProductName.indexOf("AS") != -1) {
String s = databaseProductVersion.substring(databaseProductVersion // default to V5R4
.indexOf('V')); maj = 5;
min = 4;
int index = databaseProductVersion.indexOf('V');
if (index != -1) {
String s = databaseProductVersion.substring(index);
s = s.toUpperCase(); s = s.toUpperCase();
StringTokenizer stringtokenizer = new StringTokenizer(s, "VRM" StringTokenizer stringtokenizer = new StringTokenizer(s, "VRM"
@ -452,6 +457,23 @@ public class DB2Dictionary
min = Integer.parseInt(s2); min = Integer.parseInt(s2);
} }
} }
else {
index = databaseProductVersion.indexOf('0');
if (index != -1) {
String s = databaseProductVersion.substring(index);
s = s.toUpperCase();
StringTokenizer stringtokenizer = new StringTokenizer(s, "0"
, false);
if (stringtokenizer.countTokens() == 2) {
String s1 = stringtokenizer.nextToken();
maj = Integer.parseInt(s1);
String s2 = stringtokenizer.nextToken();
min = Integer.parseInt(s2);
}
}
}
}
} }
private void getProductVersionMajorMinor() { private void getProductVersionMajorMinor() {