mirror of https://github.com/apache/openjpa.git
OPENJPA-1067. Merely log SQLException from setQueryTimeout for DB2 on Z/OS
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@778852 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5b53615609
commit
2e9f4187cc
|
@ -21,6 +21,7 @@ package org.apache.openjpa.jdbc.sql;
|
|||
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 @@ public class DB2Dictionary
|
|||
|
||||
private EnumSet<DBIdentifiers> unsupportedDelimitedIds =
|
||||
EnumSet.of(DBIdentifiers.COLUMN_COLUMN_DEFINITION);
|
||||
|
||||
|
||||
public DB2Dictionary() {
|
||||
platform = "DB2";
|
||||
validationSQL = "SELECT DISTINCT(CURRENT TIMESTAMP) FROM "
|
||||
|
@ -324,10 +325,11 @@ public class DB2Dictionary
|
|||
+ "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 @@ public class DB2Dictionary
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -189,3 +189,8 @@ null-blob-in-not-nullable: Can not set null value on column "{0}" \
|
|||
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}.
|
||||
|
|
Loading…
Reference in New Issue