Return-Path: Delivered-To: apmail-openjpa-commits-archive@www.apache.org Received: (qmail 75471 invoked from network); 26 May 2009 19:12:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 26 May 2009 19:12:51 -0000 Received: (qmail 71646 invoked by uid 500); 26 May 2009 19:13:03 -0000 Delivered-To: apmail-openjpa-commits-archive@openjpa.apache.org Received: (qmail 71619 invoked by uid 500); 26 May 2009 19:13:03 -0000 Mailing-List: contact commits-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list commits@openjpa.apache.org Received: (qmail 71610 invoked by uid 99); 26 May 2009 19:13:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 May 2009 19:13:03 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 May 2009 19:13:01 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 75CC223888CB; Tue, 26 May 2009 19:12:41 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@openjpa.apache.org From: mikedd@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090526191241.75CC223888CB@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 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}.