Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 357569 - DB Platform Detection does not support version
Summary: DB Platform Detection does not support version
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: David Minsky CLA
QA Contact: Project Inbox CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-13 17:38 EDT by David Minsky CLA
Modified: 2022-06-09 10:05 EDT (History)
0 users

See Also:


Attachments
Proposed patch (11.43 KB, patch)
2011-09-14 18:19 EDT, David Minsky CLA
no flags Details | Diff
Updated patch (12.12 KB, patch)
2011-09-15 17:32 EDT, David Minsky CLA
no flags Details | Diff
Fix to DBPlatformHelper to enable jdk15 compatibility (1.00 KB, patch)
2011-09-26 15:31 EDT, David Minsky CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Minsky CLA 2011-09-13 17:38:40 EDT
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.
Comment 1 David Minsky CLA 2011-09-13 17:51:51 EDT
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
Comment 2 David Minsky CLA 2011-09-14 18:19:02 EDT
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
Comment 3 David Minsky CLA 2011-09-15 16:46:42 EDT
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
Comment 4 David Minsky CLA 2011-09-15 17:32:33 EDT
Created attachment 203457 [details]
Updated patch

Updated comments in VendorNameToPlatformMapping.properties
Comment 5 David Minsky CLA 2011-09-16 13:53:35 EDT
Checked into trunk (2.4) at revision 10107
Comment 6 David Minsky CLA 2011-09-16 15:50:07 EDT
Checked into 2.3 (2.3.1) at revision: 10108
Comment 7 David Minsky CLA 2011-09-26 15:31:03 EDT
Created attachment 204037 [details]
Fix to DBPlatformHelper to enable jdk15 compatibility
Comment 8 David Minsky CLA 2011-09-26 17:55:04 EDT
Minor change (jdk 1.5 compatibility update) checked in:

trunk (2.4) - revision 10173
2.3.1 - revision 10174
Comment 9 Eclipse Webmaster CLA 2022-06-09 10:05:20 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink