db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/metadata JdbcMetadataUtils.java
Date Fri, 21 Jan 2005 11:45:18 GMT
tomdz       2005/01/21 03:45:18

  Modified:    src/java/org/apache/ojb/broker/metadata
                        JdbcMetadataUtils.java
  Log:
  Replaced usage of JDK1.4/1.5-only call to getJDBCMajorVersion/getJDBCMinorVersion
  
  Revision  Changes    Path
  1.3       +8 -2      db-ojb/src/java/org/apache/ojb/broker/metadata/JdbcMetadataUtils.java
  
  Index: JdbcMetadataUtils.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/JdbcMetadataUtils.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JdbcMetadataUtils.java	7 Jan 2005 23:02:12 -0000	1.2
  +++ JdbcMetadataUtils.java	21 Jan 2005 11:45:18 -0000	1.3
  @@ -21,6 +21,7 @@
   import java.util.HashMap;
   
   import javax.sql.DataSource;
  +import org.apache.commons.beanutils.PropertyUtils;
   
   /**
    * This class provides some utility functions to OJB for working with JDBC metadata.
  @@ -304,11 +305,16 @@
           }
           try
           {
  -            jcd.setJdbcLevel(Double.parseDouble(String.valueOf(metadata.getJDBCMajorVersion())+"."+String.valueOf(metadata.getJDBCMinorVersion())));
  +            // this will only work with JDK >= 1.4 and only with some jdbc drivers
  +            Integer majorVersion = (Integer)PropertyUtils.getProperty(metadata, "JDBCMajorVersion");
  +            Integer minorVersion = (Integer)PropertyUtils.getProperty(metadata, "JDBCMinorVersion");
  +
  +            jcd.setJdbcLevel(Double.parseDouble(majorVersion.toString()+"."+minorVersion.toString()));
           }
           catch (Throwable t)
           {
  -            // we ignore the exception which might be thrown by some jdbc drivers (e.g.
Hsqldb)
  +            // otherwise we're assuming JDBC 2.0 compliance
  +            jcd.setJdbcLevel(2.0);
           }
           try
           {
  
  
  

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


Mime
View raw message