openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mprud...@apache.org
Subject svn commit: r495027 - /incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
Date Wed, 10 Jan 2007 23:00:39 GMT
Author: mprudhom
Date: Wed Jan 10 15:00:38 2007
New Revision: 495027

URL: http://svn.apache.org/viewvc?view=rev&rev=495027
Log:
Put getJDBCMajorVersion() in a try/catch block, since it is a JDBC 3-only method, so it might
throw an AnstractMethodError.

Modified:
    incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java?view=diff&rev=495027&r1=495026&r2=495027
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
(original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
Wed Jan 10 15:00:38 2007
@@ -148,11 +148,20 @@
         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();
 



Mime
View raw message