Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [dtp-dev] bug#149611 - Database Version is not flexible ...

Rob

I like to comment on the current impl of JDBCConnection class.

The JDBCConnection class's constructor is as below

public JDBCConnection(IConnectionProfile profile, Class factoryClass) {
               super(profile, factoryClass);
               open();
       }

If I have a subclass as below
class OracleJDBCConnection extends JDBCConnection{
   String providerName = null;
   public OracleJDBCConnection(){
      super();
      providerName = "Oracle Database";
   }

  @Override
  public String getProviderName(){
      return providerName;
  }
}

The super() flows into open() in superclass which calls getProviderName() along the line; but the subclass havenot populated providerName value yet, which results a NPE. This results the label provider to fail in the contentNavigator context.

The call stack copied from Eclipse is as below
OracleJDBCConnection.getProviderName() line: 50 OracleJDBCConnection(VersionProviderConnection).updateServerVersion(Properties) line: 174 OracleJDBCConnection(VersionProviderConnection).updateVersionCache() line: 86 OracleJDBCConnection(DriverConnectionBase).internalCreateConnection() line: 112 OracleJDBCConnection(DriverConnectionBase).open() line: 53 OracleJDBCConnection(JDBCConnection).<init>(IConnectionProfile, Class) line: 48 OracleJDBCConnection.<init>(IConnectionProfile, Class) line: 20 OracleJDBCConnectionFactory.createConnection(IConnectionProfile) line: 15 ConnectionFactoryProvider.createConnection(IConnectionProfile, String, String) line: 85 ConnectionFactoryProvider.createConnection(IConnectionProfile) line: 69 ConnectionProfile.createConnection(String) line: 304 ConnectionInfoImpl.<init>(IConnectionProfile, Class) line: 622 SQMConnectionFactory(ConnectionFactory).createConnection(IConnectionProfile) line: 36 SQMConnectionFactory.createConnection(IConnectionProfile) line: 45 ConnectionFactoryAdapterProvider.createConnection(IConnectionProfile) line: 79 CreateConnectionJob.run(IProgressMonitor) line: 55 Worker.run() line: 58
So my suggestion is to move out the open() from JDBCConnection(..).

Regards
Anthos

rcernich@xxxxxxxxxx wrote:
Hey Anthos,

Could you please provide specific examples where you cannot satisfactorily
override the default behavior?  I would like to resolve any shortcomings in
the API that restrict specialization (as this is a framework, it is
important that the behavior can be customized, within limits of course).

See below for comments on the specific usages you listed.

Best regards,
Rob

dtp-dev-bounces@xxxxxxxxxxx wrote on 07/06/2006 04:13:40 PM:

The static method Version.valueOf(..) is in used in few places in the
core code, which makes it difficult to override the Version class to
handle vendor specific way.

You can provide whatever data is required to the valueOf() method.  This
may require formatting your input prior to invoking valueOf().  You can
always use the constructor directly, which specifies individual parameters
for major, minor, release, and build components.


projects/opensource/eclipse-src/org.eclipse.datatools.connectivity/
plugins/org.eclipse.datatools.connectivity/src/org/eclipse/datatools/
connectivity/VersionProviderConnection.java:149:
Version oldTechVersion = Version.valueOf(props.getProperty(

Version information is stored in the properties using Version.toString()
(Version.valueOf(aVersion.toString()).equals(aVersion) == true).

projects/opensource/eclipse-src/org.eclipse.datatools.connectivity/
plugins/org.eclipse.datatools.connectivity/src/org/eclipse/datatools/
connectivity/VersionProviderConnection.java:175:             Version
oldServerVersion = Version.valueOf(props.getProperty(

Same as preceding comment.


projects/opensource/eclipse-src/org.eclipse.datatools.connectivity/
plugins/org.eclipse.datatools.connectivity.db.generic/src/org/eclipse/
datatools/connectivity/db/generic/JDBCConnection.java:
152:                          mServerVersion = Version.valueOf
(versionString);

Assumes DatabaseMetaData.getDatabaseProductVersion() is of the form
<int>.<int>.<int>.<string>; not sure what the JDBC specification says about
the string returned by this method.  However, since extenders have the
ability to override the IServerVersionProvider methods on JDBCConnection,
they can easily tailor the implementation of these to match the information
returned by their server (e.g. by reformatting the string or by
instantiating a version object directly using its constructor).


projects/opensource/eclipse-src/org.eclipse.datatools.connectivity/
plugins/org.eclipse.datatools.connectivity.oda.profile/src/org/
eclipse/datatools/connectivity/oda/profile/OdaConnectionWrapper.java:
144:            return Version.valueOf
( m_odaMetadataHelper.getDataSourceProductVersion() );

I assume this is internally consistent with ODA (i.e. that
getDataSourceProductVersion() returns a compatible string).


projects/opensource/eclipse-src/org.eclipse.datatools.connectivity/
plugins/org.eclipse.datatools.connectivity.oda.profile/src/org/
eclipse/datatools/connectivity/oda/profile/OdaConnectionWrapper.java:
179:        return Version.valueOf( Constants.ODA_COMPONENT_VERSION );

Same as preceding comment.

_______________________________________________
dtp-dev mailing list
dtp-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dtp-dev



Back to the top