openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mik...@apache.org
Subject svn commit: r778852 - in /openjpa/trunk/openjpa-jdbc/src/main: java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java resources/org/apache/openjpa/jdbc/sql/localizer.properties
Date Tue, 26 May 2009 19:12:41 GMT
Author: mikedd
Date: Tue May 26 19:12:40 2009
New Revision: 778852

URL: http://svn.apache.org/viewvc?rev=778852&view=rev
Log:
OPENJPA-1067. Merely log SQLException from setQueryTimeout for DB2 on Z/OS

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
    openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/localizer.properties

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java?rev=778852&r1=778851&r2=778852&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
Tue May 26 19:12:40 2009
@@ -21,6 +21,7 @@
 import java.lang.reflect.Method;
 import java.sql.Connection;
 import java.sql.DatabaseMetaData;
+import java.sql.PreparedStatement;
 import java.sql.SQLException;
 import java.sql.Types;
 import java.util.Arrays;
@@ -86,7 +87,7 @@
     
     private EnumSet<DBIdentifiers> unsupportedDelimitedIds =
         EnumSet.of(DBIdentifiers.COLUMN_COLUMN_DEFINITION); 
-
+    
     public DB2Dictionary() {
         platform = "DB2";
         validationSQL = "SELECT DISTINCT(CURRENT TIMESTAMP) FROM "
@@ -324,10 +325,11 @@
                 + "NAME AS SEQUENCE_NAME FROM SYSIBM.SYSSEQUENCES";
             sequenceSchemaSQL = "SCHEMA = ?";
             sequenceNameSQL = "NAME = ?";
-            if (maj == 8)
+            if (maj == 8) {
                 // DB2 Z/OS Version 8: no bigint support, hence map Java
                 // long to decimal
                 bigintTypeName = "DECIMAL(31,0)";
+            }
             break;
         case db2ISeriesV5R3OrEarlier:
         case db2ISeriesV5R4OrLater:
@@ -885,4 +887,28 @@
     protected void setDelimitedCase(DatabaseMetaData metaData) {
         delimitedCase = SCHEMA_CASE_PRESERVE;
     }
+    
+    /**
+     * The Type 2 JDBC Driver may throw an SQLException when provided a non-
+     * zero timeout if we're connected to Z/OS. The SQLException should be
+     * logged but not thrown.
+     */
+    @Override
+    public void setQueryTimeout(PreparedStatement stmnt, int timeout)
+        throws SQLException {
+        if(isDB2ZOSV8xOrLater()) { 
+            try { 
+                super.setQueryTimeout(stmnt, timeout);
+            }
+            catch (SQLException e) {
+                if (log.isTraceEnabled()) {
+                    log.trace(_loc.get("error-setting-query-timeout", timeout,
+                        e.getMessage()), e);
+                }
+            }
+        }
+        else { 
+            super.setQueryTimeout(stmnt, timeout);
+        }
+    }
 }

Modified: openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/localizer.properties
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/localizer.properties?rev=778852&r1=778851&r2=778852&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/localizer.properties
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/localizer.properties
Tue May 26 19:12:40 2009
@@ -189,3 +189,8 @@
 	because the corresponding field is set to be non-nullable.
 invalid-timeout: An invalid timeout of {0} milliseconds was ignored.  \
         Expected a value that is greater than or equal to zero.
+error-setting-query-timeout: A SQLException was thrown when trying to set the \
+	queryTimeout to {0}. We believe the exception is not fatal and will \
+    continue processing. If this is a benign error you may disable it entirely \
+	by setting the supportsQueryTimeout attribute on the DBDictionary to false.\
+	The exception thrown was {1}.



Mime
View raw message