You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by ce...@apache.org on 2004/06/01 22:29:13 UTC

cvs commit: logging-log4j/src/java/org/apache/log4j/db ConnectionSourceSkeleton.java

ceki        2004/06/01 13:29:13

  Modified:    src/java/org/apache/log4j/db ConnectionSourceSkeleton.java
  Log:
  If the JDBC driver is not 3.0 compliant, then it might throw an
  exception when the DatabaseMetaData.supportsGetGeneratedKeys method is
  called.
  
  We cater for that eventuality.
  
  Revision  Changes    Path
  1.4       +10 -1     logging-log4j/src/java/org/apache/log4j/db/ConnectionSourceSkeleton.java
  
  Index: ConnectionSourceSkeleton.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/db/ConnectionSourceSkeleton.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ConnectionSourceSkeleton.java	24 May 2004 16:14:34 -0000	1.3
  +++ ConnectionSourceSkeleton.java	1 Jun 2004 20:29:13 -0000	1.4
  @@ -49,13 +49,22 @@
           return;
         }
         DatabaseMetaData meta = connection.getMetaData();
  -      supportsGetGeneratedKeys = meta.supportsGetGeneratedKeys();
  +      supportsGetGeneratedKeys = supportsGetGeneratedKeys(meta);
         dialectCode = Util.discoverSQLDialect(meta);
       } catch (SQLException se) {
         LogLog.warn("Could not discover the dialect to use.", se);
       }
     }
   
  +  boolean supportsGetGeneratedKeys(DatabaseMetaData meta) {
  +    try {
  +      return meta.supportsGetGeneratedKeys();
  +    } catch(Exception e) {
  +      LogLog.warn("Could not call supportsGetGeneratedKeys method.", e);
  +      return false;
  +    }
  +  }
  +  
     /**
      * Does this connection support the JDBC Connection.getGeneratedKeys method?
      */
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org