Community
Participate
Working Groups
Currently, DB Platform detection does not support matching against a database platform's version, only the vendor name is obtained from DatabaseMetaData getDatabaseProductName() to determine which platform to use. As a result of this, (for example) the default platform chosen for an Oracle database from the VendorNameToPlatformMapping.properties is the Oracle10Platform (?i)oracle.*=org.eclipse.persistence.platform.database.oracle.Oracle10Platform If the database is Oracle 11, the platform would not be set correctly, which is not optimal for some systems utilizing Oracle LOBs.
A proposed solution to this issue is: 1. The VendorNameToPlatformMapping.properties file needs to be read and processed "in order", line by line, from top to bottom. Currently, it is loaded into a Properties object, and that Properties object is iterated for regular expression matches. and: 2. The regular expressions within VendorNameToPlatformMapping.properties need to also be able to support a database version. Concatenating the "product name" and "major version" Strings returned from the DatabaseMetaData getDatabaseProductName() and DatabaseMetaData getDatabaseMajorVersion(), along with modifying the regular expressions within VendorNameToPlatformMapping.properties is the simplest way to implement this change. This would allow the VendorNameToPlatformMapping.properties to be set up to accommodate correct version->platform combinations: (?i)oracle.*11=org.eclipse.persistence.platform.database.oracle.Oracle11Platform (?i)oracle.*10=org.eclipse.persistence.platform.database.oracle.Oracle10Platform (?i)oracle.*9=org.eclipse.persistence.platform.database.oracle.Oracle9Platform (?i)oracle.*=org.eclipse.persistence.platform.database.oracle.OraclePlatform
Created attachment 203373 [details] Proposed patch Patch does the following: - Changes to DatabaseSessionImpl to concatenate DatabaseMetaData.getDatabaseProductName() and DatabaseMetaData().getDatabaseMajorVersion(), then pass this to DBPlatformHelper.getDBPlatform - Changes to exception resource text for DBPlatformHelper to clarify error messages - Changes to DBPlatformHelper to support a sequential approach to reading the VendorNameToPlatformMapping.properties file, and storing the results in a List - Changes to VendorNameToPlatformMapping.properties existing regular expressions to support the concatenation of DatabaseMetaData.getDatabaseProductName() and DatabaseMetaData().getDatabaseMajorVersion() (mostly adding .* to existing regular expressions) - Added Oracle platform classes for Oracle9, Oracle10, Oracle11, Oracle* to VendorNameToPlatformMapping.properties
VendorNameToPlatformMapping.properties regular expression & platform class changes to support "database product name" + "database major version" concatenation: SQL Anywhere: SQL\ Anywhere.*=org.eclipse.persistence.platform.database.SQLAnywherePlatform Oracle: (?i)oracle.*11=org.eclipse.persistence.platform.database.oracle.Oracle11Platform (?i)oracle.*10=org.eclipse.persistence.platform.database.oracle.Oracle10Platform (?i)oracle.*9=org.eclipse.persistence.platform.database.oracle.Oracle9Platform (?i)oracle.*=org.eclipse.persistence.platform.database.oracle.OraclePlatform SQL Server: (SQL\ Server.*)=org.eclipse.persistence.platform.database.SybasePlatform Derby / JavaDB: (?i).*derby.*=org.eclipse.persistence.platform.database.JavaDBPlatform SAP DB / MaxDB: SAP\ DB=org.eclipse.persistence.platform.database.MaxDBPlatform
Created attachment 203457 [details] Updated patch Updated comments in VendorNameToPlatformMapping.properties
Checked into trunk (2.4) at revision 10107
Checked into 2.3 (2.3.1) at revision: 10108
Created attachment 204037 [details] Fix to DBPlatformHelper to enable jdk15 compatibility
Minor change (jdk 1.5 compatibility update) checked in: trunk (2.4) - revision 10173 2.3.1 - revision 10174
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink