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; 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 { public void connectedConfiguration(Connection conn) throws SQLException {
super.connectedConfiguration(conn); super.connectedConfiguration(conn);
@ -266,7 +257,7 @@ public class DB2Dictionary
} }
if (db2ServerType == 0) { if (db2ServerType == 0) {
if (isJDBC3(metaData)) { if (isJDBC3) {
maj = metaData.getDatabaseMajorVersion(); maj = metaData.getDatabaseMajorVersion();
min = metaData.getDatabaseMinorVersion(); min = metaData.getDatabaseMinorVersion();
} }

View File

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

View File

@ -121,7 +121,6 @@ public class InformixDictionary
})); }));
supportsQueryTimeout = false; supportsQueryTimeout = false;
supportsMultipleNontransactionalResultSets = false;
supportsLockingWithDistinctClause = false; supportsLockingWithDistinctClause = false;
supportsLockingWithMultipleTables = false; supportsLockingWithMultipleTables = false;
supportsLockingWithOrderClause = false; supportsLockingWithOrderClause = false;
@ -161,6 +160,13 @@ public class InformixDictionary
else else
driverVendor = VENDOR_OTHER; 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, public Column[] getColumns(DatabaseMetaData meta, String catalog,