openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fa...@apache.org
Subject svn commit: r663358 - in /openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql: DB2Dictionary.java DBDictionary.java InformixDictionary.java
Date Wed, 04 Jun 2008 19:49:42 GMT
Author: fancy
Date: Wed Jun  4 12:49:41 2008
New Revision: 663358

URL: http://svn.apache.org/viewvc?rev=663358&view=rev
Log:
OPENJPA-622 Informix -lock timieout, cursor not open problem for NonJTA datasource transaction
RESOURCE_LOCAL in JEE

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/InformixDictionary.java

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=663358&r1=663357&r2=663358&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
Wed Jun  4 12:49:41 2008
@@ -238,15 +238,6 @@
         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 @@
         }
         
     	if (db2ServerType == 0) {
-    	    if (isJDBC3(metaData)) {
+    	    if (isJDBC3) {
     	        maj = metaData.getDatabaseMajorVersion();
     	        min = metaData.getDatabaseMinorVersion();
     	    }

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java?rev=663358&r1=663357&r2=663358&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
Wed Jun  4 12:49:41 2008
@@ -327,6 +327,7 @@
     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();
@@ -374,27 +375,28 @@
     public void connectedConfiguration(Connection conn)
         throws SQLException {
         if (!connected) {
-            DatabaseMetaData metaData = null;            
+            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;

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/InformixDictionary.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/InformixDictionary.java?rev=663358&r1=663357&r2=663358&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/InformixDictionary.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/InformixDictionary.java
Wed Jun  4 12:49:41 2008
@@ -121,7 +121,6 @@
         }));
 
         supportsQueryTimeout = false;
-        supportsMultipleNontransactionalResultSets = false;
         supportsLockingWithDistinctClause = false;
         supportsLockingWithMultipleTables = false;
         supportsLockingWithOrderClause = false;
@@ -161,6 +160,13 @@
             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,



Mime
View raw message