You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by mi...@apache.org on 2009/05/26 20:59:20 UTC

svn commit: r778847 - in /openjpa/branches/1.0.x/openjpa-jdbc/src/main: java/org/apache/openjpa/jdbc/kernel/ java/org/apache/openjpa/jdbc/sql/ resources/org/apache/openjpa/jdbc/kernel/

Author: mikedd
Date: Tue May 26 18:59:20 2009
New Revision: 778847

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

Modified:
    openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PessimisticLockManager.java
    openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
    openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
    openjpa/branches/1.0.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/kernel/localizer.properties

Modified: openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PessimisticLockManager.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PessimisticLockManager.java?rev=778847&r1=778846&r2=778847&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PessimisticLockManager.java (original)
+++ openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PessimisticLockManager.java Tue May 26 18:59:20 2009
@@ -139,7 +139,20 @@
                     if (log.isWarnEnabled())
                         log.warn(_loc.get("millis-query-timeout"));
                 }
-                stmnt.setQueryTimeout(timeout / 1000);
+                try { 
+                    stmnt.setQueryTimeout(timeout / 1000);
+                }
+                catch(SQLException e) { 
+                    if(! dict.ignoreSQLExceptionOnSetQueryTimeout) { 
+                        throw e;
+                    }
+                    else {
+                        if (log.isTraceEnabled()) {
+                            log.trace(_loc.get("error-setting-query-timeout",
+                                new Integer(timeout), e.getMessage()), e);
+                        }
+                    }
+                }
             }
             rs = stmnt.executeQuery();
             if (!rs.next())

Modified: openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java?rev=778847&r1=778846&r2=778847&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java (original)
+++ openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java Tue May 26 18:59:20 2009
@@ -274,10 +274,12 @@
                 + "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)";
+            }
+            ignoreSQLExceptionOnSetQueryTimeout = true; 
             break;
         case db2ISeriesV5R3OrEarlier:
         case db2ISeriesV5R4OrLater:

Modified: openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java?rev=778847&r1=778846&r2=778847&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java (original)
+++ openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java Tue May 26 18:59:20 2009
@@ -308,7 +308,19 @@
     protected final Set systemSchemaSet = new HashSet();
     protected final Set systemTableSet = new HashSet();
     protected final Set fixedSizeTypeNameSet = new HashSet();
-
+    
+    /**
+     * Some JDBC drivers - ie DB2 type 2 on Z/OS throw exceptions on
+     * setQueryTimeout when provided specific input values.
+     * To remain consistent with earlier versions of the driver we should ignore
+     * the exception.
+     * 
+     * This variable will be removed in future releases when we can handle the
+     * exception properly.
+     * @deprecated
+     */ 
+    public boolean ignoreSQLExceptionOnSetQueryTimeout = false; 
+    
     /**
      * If a native query begins with any of the values found here then it will
      * be treated as a select statement.  

Modified: openjpa/branches/1.0.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/kernel/localizer.properties
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/kernel/localizer.properties?rev=778847&r1=778846&r2=778847&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/kernel/localizer.properties (original)
+++ openjpa/branches/1.0.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/kernel/localizer.properties Tue May 26 18:59:20 2009
@@ -110,3 +110,8 @@
 	is nullable (optional).
 graph-not-cycle-free: A circular flush dependency has been found after all \
     circular dependencies should have been resolved.
+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}.
\ No newline at end of file