Put getJDBCMajorVersion() in a try/catch block, since it is a JDBC 3-only method, so it might throw an AnstractMethodError.

git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@495027 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Marc Prud'hommeaux 2007-01-10 23:00:38 +00:00
parent c6121be583
commit 9851f62748
1 changed files with 10 additions and 1 deletions

View File

@ -148,11 +148,20 @@ public class DB2Dictionary
return conn;
}
private boolean isJDBC3(DatabaseMetaData meta) {
try {
// JDBC3-only method, so it might throw a AbstractMethodError
return meta.getJDBCMajorVersion() >= 3;
} catch (Throwable t) {
return false;
}
}
public void connectedConfiguration(Connection conn) throws SQLException {
super.connectedConfiguration(conn);
DatabaseMetaData metaData = conn.getMetaData();
if (metaData.getJDBCMajorVersion() >= 3) {
if (isJDBC3(metaData)) {
int maj = metaData.getDatabaseMajorVersion();
int min = metaData.getDatabaseMinorVersion();