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

Bug 328738

Summary: Enablement implementations of IConnectionFactory.createConnection(IConnectionProfile profile, String uid, String pwd) disregard uid and pwd.
Product: [Tools] Data Tools Reporter: jdoyleoss
Component: EnablementAssignee: Brian Fitzpatrick <bfitzpat>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3    
Version: 1.8.1   
Target Milestone: 1.9   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
How to reproduce
none
Patch for Connectivity & Oracle none

Description jdoyleoss CLA 2010-10-26 12:30:25 EDT
Build Identifier: M20100909-0800

All of the enablement implementations of IConnectionFactory.createConnection(IConnectionProfile profile, String uid, String pwd) disregard the uid and pwd parameters and invoke the createConnection(IConnectionProfile profile) method.  If your connection profile has no credentials, then these parameters are required for a connection.  If your profile does have them, then presumably the point of this method is to override them, and that does not happen.

Take a look at the Oracle implementation as an example:
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.datatools.enablement/plugins/org.eclipse.datatools.enablement.oracle/src/org/eclipse/datatools/enablement/internal/oracle/JDBCOracleConnectionFactory.java?view=markup&root=Datatools_Project

Reproducible: Always

Steps to Reproduce:
1. Define a connection profile with any of the enablement profiles.
2. Edit the profile to remove the username and password.
3. Get a connection from the profile using the IConnectionFactory.createConnection(IConnectionProfile profile, String uid, String pwd) call.
Comment 1 jdoyleoss CLA 2010-10-26 12:43:49 EDT
Created attachment 181746 [details]
How to reproduce

The easiest way I could think to give you a reproducible case is to use one of the plug-in wizards and hack the action.  Do the following and you should be able to see how the Oracle impl just drops the username and password.

Import the attached project to your eclipse env with the DTP + DTP Enablement SDKs installed.
Change the values in the ctor for SampleAction.
Run the plugin in debug and run the SampleAction in the new Sample Menu that's added to the Main menu bar.
If you then change the username and password in the createDriverProps() call, you'll see it work.
Comment 2 Brian Fitzpatrick CLA 2010-10-26 12:47:20 EDT
This is more than just a tweak, but we should be able to still keep API backward compatibility when the fix goes in.

The change affects everything down to the JDBCConnection/JDBCConnectionFactory level, so it will require changes to each of the enablement projects to correctly support the uid/pwd signature. 

I'm honestly not sure why this has never been seen until now - I'm guessing that the Teiid guys are just stressing the APIs in a different direction than we've seen in the past.
Comment 3 Brian Fitzpatrick CLA 2010-10-26 12:50:13 EDT
Created attachment 181747 [details]
Patch for Connectivity & Oracle

This patch solves the problem for Oracle in my local tests, but will need to be tested further.