Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 330725

Summary: Driver definition preferences not saved on export of preferences
Product: [Tools] Data Tools Reporter: Brian Payton <bpayton>
Component: ConnectivityAssignee: Brian Payton <bpayton>
Status: REOPENED --- QA Contact:
Severity: normal    
Priority: P3 CC: ajithkumar, davidaca, lchan, proberts
Version: 1.8.2   
Target Milestone: 1.10   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Patch for plugin o.e.d.connectvity
none
Patch Fix for OSGi-less platform
none
Correct Patch for OSGi-less platform fix
none
Additional Patch for existing preference store with no driver values none

Description Brian Payton CLA 2010-11-19 19:36:39 EST
The Driver Definitions in the DTP Connectivity preferences (Preferences -> Data Management -> Connectivity -> Driver Definitions) are not saved when the preferences are saved (File -> Export... -> General -> Preferences).

Steps to reproduce:
(Note: this is most clear if you start with a new runtime workspace)
1. Open the Preferences window and navigate to the Driver Definitions page (Preferences -> Data Management -> Connectivity -> Driver Definitions)
2. Click the Add... button and add a driver definition, for example Derby Embedded JDBC Driver.
3. Click OK in the New Driver Definition window and OK in the Preferences window to save the new driver definition preference.
4. Back in the main window, do File -> Export... -> General -> Preferences, click Next.  Enter or select and export file name and click Finish.
5. Close Eclipse.
6. Launch Eclipse with a new runtime workspace.
7. Do File -> Import... General -> Preferences and import the .epf file you exported previously.
8. Open the Database Definitions preference page and verify that the database definition was not imported.
Comment 1 Brian Payton CLA 2010-11-19 19:43:45 EST
Created attachment 183512 [details]
Patch for plugin o.e.d.connectvity
Comment 2 Brian Payton CLA 2010-11-19 19:46:02 EST
Hi Fitz, can you take a look at this patch?
Comment 3 Brian Fitzpatrick CLA 2010-11-24 09:56:22 EST
I'm leery of doing this kind of change in 1.8.2 to be honest. This isn't as straightforward a patch as it might be. And anything that has the potential to affect the driver and connection profiles stored in the preferences could have some less than desirable consequences. I'm not saying that's the case - but I'd want the chance to test the heck out of this stuff before we deliver it.

For 1.9, I'm fine with it.
Comment 4 Brian Payton CLA 2012-05-16 19:13:04 EDT
I'm going to go ahead and commit this change.  (As per Fitz's comment, this was originally going to go into DTP 1.9.)

Here's the Git commit record:
http://git.eclipse.org/c/datatools/org.eclipse.datatools.connectivity.git/commit/?id=df556a7e086f5f489ed823b752fc1ebf6153a6f5
Comment 5 Linda Chan CLA 2012-05-22 01:14:09 EDT
(In reply to comment #4)

The changes committed for DTP 1.10 RC1 relies on the internal platform of Eclipse OSGi, which will cause NPE when running the DTP connectivity component on an OSGi-less platform.  
It also triggers a re-read of the driverStorage.xml file whenever getting a driver instance from the DriverManager, which is rather inefficient.
Comment 6 Linda Chan CLA 2012-05-22 18:09:59 EDT
Created attachment 216081 [details]
Patch Fix for OSGi-less platform

Attached is a Git patch for review.  It fixes the bug impl. to work on OSGi-less platform.  Also in order to reduce run-time performance impact, comment out calls that re-read the driverStorage.xml file each time when simply getting a driver instance from the cached map.
Comment 7 Linda Chan CLA 2012-05-22 19:39:52 EDT
Created attachment 216084 [details]
Correct Patch for OSGi-less platform fix
Comment 8 Linda Chan CLA 2012-05-22 21:28:02 EDT
Created attachment 216086 [details]
Additional Patch for existing preference store with no driver values

This additional patch fixes the problem of wiping out the content of an existing driverStorage.xml file. This occurred when run in a workspace whose Preference store does not contain any DRIVER_VALUES entry.
Comment 9 Linda Chan CLA 2012-05-22 21:56:35 EDT
Pushed my 2 patches to the Git repo, to allow more time for testing before RC2.

Git commit logs:
* fix for OSGi-less platform: http://git.eclipse.org/c/datatools/org.eclipse.datatools.connectivity.git/commit/?id=e56c2a6e71413e82a719bede0a7e38f2d28b5d43

* fix for wiping out content of driverStorage.xml file: http://git.eclipse.org/c/datatools/org.eclipse.datatools.connectivity.git/commit/?id=bb5753f9a7194335e3abc5568f99f878d5797f11
Comment 10 Brian Payton CLA 2012-06-12 15:47:33 EDT
This fix just isn't ready for prime time.  (See bug 382153) I'm going to disable it.