OPENJPA-622 Informix -lock timieout, cursor not open problem for NonJTA datasource transaction RESOURCE_LOCAL in JEE

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@663358 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Catalina Wei 2008-06-04 19:49:41 +00:00
parent 1fda19f8b7
commit 8a80d753a3
3 changed files with 28 additions and 29 deletions

View File

@ -238,15 +238,6 @@ public class DB2Dictionary
return conn;
}
private boolean isJDBC3(DatabaseMetaData meta) {
try {
// JDBC3-only method, so it might throw a AbstractMethodError
return meta.getJDBCMajorVersion() >= 3;
} catch (Throwable t) {
return false;
}
}
public void connectedConfiguration(Connection conn) throws SQLException {
super.connectedConfiguration(conn);
@ -266,7 +257,7 @@ public class DB2Dictionary
}
if (db2ServerType == 0) {
if (isJDBC3(metaData)) {
if (isJDBC3) {
maj = metaData.getDatabaseMajorVersion();
min = metaData.getDatabaseMinorVersion();
}

View File

@ -327,6 +327,7 @@ public class DBDictionary
protected JDBCConfiguration conf = null;
protected Log log = null;
protected boolean connected = false;
protected boolean isJDBC3 = false;
protected final Set reservedWordSet = new HashSet();
protected final Set systemSchemaSet = new HashSet();
protected final Set systemTableSet = new HashSet();
@ -376,25 +377,26 @@ public class DBDictionary
if (!connected) {
DatabaseMetaData metaData = null;
try {
if (log.isTraceEnabled()) {
metaData = conn.getMetaData();
boolean isJDBC3 = false;
log.trace(DBDictionaryFactory.toString
(metaData));
try {
// JDBC3-only method, so it might throw a
// AbstractMethodError
isJDBC3 = metaData.getJDBCMajorVersion() >= 3;
} catch (Throwable t) {
// ignore if not JDBC3
}
if (isJDBC3)
log.trace(_loc.get("connection-defaults", new Object[]{
conn.getAutoCommit(), conn.getHoldability(),
conn.getTransactionIsolation()}));
metaData = conn.getMetaData();
try {
// JDBC3-only method, so it might throw a
// AbstractMethodError
isJDBC3 = metaData.getJDBCMajorVersion() >= 3;
} catch (Throwable t) {
// ignore if not JDBC3
}
} catch (Exception e) {
log.trace(e.toString(), e);
if (log.isTraceEnabled())
log.trace(e.toString(), e);
}
if (log.isTraceEnabled()) {
log.trace(DBDictionaryFactory.toString(metaData));
if (isJDBC3)
log.trace(_loc.get("connection-defaults", new Object[]{
conn.getAutoCommit(), conn.getHoldability(),
conn.getTransactionIsolation()}));
}
}
connected = true;

View File

@ -121,7 +121,6 @@ public class InformixDictionary
}));
supportsQueryTimeout = false;
supportsMultipleNontransactionalResultSets = false;
supportsLockingWithDistinctClause = false;
supportsLockingWithMultipleTables = false;
supportsLockingWithOrderClause = false;
@ -161,6 +160,13 @@ public class InformixDictionary
else
driverVendor = VENDOR_OTHER;
}
if (isJDBC3) {
conn.setHoldability(ResultSet.HOLD_CURSORS_OVER_COMMIT);
if (log.isTraceEnabled())
log.trace(_loc.get("connection-defaults", new Object[]{
conn.getAutoCommit(), conn.getHoldability(),
conn.getTransactionIsolation()}));
}
}
public Column[] getColumns(DatabaseMetaData meta, String catalog,