OPENJPA-1067. Merely log SQLException from setQueryTimeout for DB2 on Z/OS

git-svn-id: https://svn.apache.org/repos/asf/openjpa/branches/1.0.x@778847 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Dick 2009-05-26 18:59:20 +00:00
parent cec5147712
commit 3187b81415
4 changed files with 35 additions and 3 deletions

View File

@ -139,8 +139,21 @@ public class PessimisticLockManager
if (log.isWarnEnabled()) if (log.isWarnEnabled())
log.warn(_loc.get("millis-query-timeout")); log.warn(_loc.get("millis-query-timeout"));
} }
try {
stmnt.setQueryTimeout(timeout / 1000); 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(); rs = stmnt.executeQuery();
if (!rs.next()) if (!rs.next())
throw new LockException(sm.getManagedInstance()); throw new LockException(sm.getManagedInstance());

View File

@ -274,10 +274,12 @@ public class DB2Dictionary
+ "NAME AS SEQUENCE_NAME FROM SYSIBM.SYSSEQUENCES"; + "NAME AS SEQUENCE_NAME FROM SYSIBM.SYSSEQUENCES";
sequenceSchemaSQL = "SCHEMA = ?"; sequenceSchemaSQL = "SCHEMA = ?";
sequenceNameSQL = "NAME = ?"; sequenceNameSQL = "NAME = ?";
if (maj == 8) if (maj == 8) {
// DB2 Z/OS Version 8: no bigint support, hence map Java // DB2 Z/OS Version 8: no bigint support, hence map Java
// long to decimal // long to decimal
bigintTypeName = "DECIMAL(31,0)"; bigintTypeName = "DECIMAL(31,0)";
}
ignoreSQLExceptionOnSetQueryTimeout = true;
break; break;
case db2ISeriesV5R3OrEarlier: case db2ISeriesV5R3OrEarlier:
case db2ISeriesV5R4OrLater: case db2ISeriesV5R4OrLater:

View File

@ -309,6 +309,18 @@ public class DBDictionary
protected final Set systemTableSet = new HashSet(); protected final Set systemTableSet = new HashSet();
protected final Set fixedSizeTypeNameSet = 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 * If a native query begins with any of the values found here then it will
* be treated as a select statement. * be treated as a select statement.

View File

@ -110,3 +110,8 @@ no-nullable-fk: No nullable foreign key found to resolve circular flush\n\
is nullable (optional). is nullable (optional).
graph-not-cycle-free: A circular flush dependency has been found after all \ graph-not-cycle-free: A circular flush dependency has been found after all \
circular dependencies should have been resolved. 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}.