Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Db2 JDBC driver should be included from Maven repository #455

Open
dwadler opened this issue May 24, 2021 · 3 comments
Open

Db2 JDBC driver should be included from Maven repository #455

dwadler opened this issue May 24, 2021 · 3 comments

Comments

@dwadler
Copy link
Contributor

dwadler commented May 24, 2021

In the past, the Db2 JDBC driver was not publicly available and there was special logic in the Db2 pom-libs.xml to create dummy driver files that were copied into the deployment. At runtime, a dialog was displayed for the user to specify the location of the real driver files which were then copied into the deployment.

The Db2 JDBC driver is now available from Maven central but I haven't been successful in getting the uDig 'mvn install -f pom-libs.xml' to copy the driver files to the needed places.

In attempting to make this work, I did the following:

  • removed from udig-platform-master/pom-libs.xml
    plugins/org.locationtech.udig.libs.db2/pom-libs.xml
  • added to udig-platform-master/plugins/org.locationtech.udig.libs/pom-libs.xml
    <dependency>
      <groupId>com.ibm.db2</groupId>
      <artifactId>jcc</artifactId>
      <version>11.5.5.0</version>
    </dependency>
  • added to udig-platform-master/plugins/org.locationtech.udig.libs/META-INF/MANIFEST.MF
    in Bundle-ClassPath: section
    lib/jcc-11.5.5.0.jar,
    in Export-Package: section
    com.ibm.db2,

It does populate jcc-11.5.5.0.jar to the local Maven repository but it doesn't copy the driver as it does with, for example, postgresql-42.2.5.jar.

I have very little understanding of how the mvn pom files or MANIFEST.MF files work.

Help would be appreciated.

@egouge
Copy link
Contributor

egouge commented May 24, 2021 via email

@fgdrf
Copy link
Contributor

fgdrf commented May 24, 2021

Looks like your found the magic places ;)
not sure if I'm remembering correctly, I guess the dummy-approach was because of two facts:

  • these libraries might have another license then udig project itself (and to avoid problems withe the license-model at packaging time)
  • One uDig is release and drivers are packaged, the user cannot easily change to patch/release version of jdbc drivers

However, its quite complicated from user-perspective and useablity . Therefore I can try to create a CQ Request at eclipse.org first to verify if its allowed to bundle db2 jdbc drivers. Maybe BIRT-Project created a similar request in the past, we will see

Independent from this, just a question : Are the db2 jdbc-drivers compatible with oder versions of db-installations? Means if I use the newest drivers, can I still acces older db2 database installations?

@dwadler please do not change the libs-download (these are common geospatial libraries), In terms of seperation of concerns, the db2 bundle has been created to allow to create GIS application with or without db2 capabilities. Please use the pom-libs.xml from libs bundle as a template (or even better a smaller one https://github.com/locationtech/udig-platform/blob/master/plugins/org.locationtech.udig.libs.jfreechart/pom-libs.xml) and adapt it in libs.db2 bundle. There is already a libs folder where the dummy-jars are copied to. Theser are bundled into libs.db2 because build.properties has libs folder in bin.includes configured already.

Could you test uDig first with the existing aproach to configure libs at runtime? If changes are required (as it was fffde2f) we can fix it.

@dwadler
Copy link
Contributor Author

dwadler commented Jun 15, 2021

After thinking about this, I think there are 3 options:

  1. Include the DB2 JDBC driver in the uDig packaging. This is physically possible as described above but the issue remains with the licensing. My IBM contact said to simply follow the license information but so far this is incomprehensible in practical terms.
  2. Modify the current code and documentation to reflect that the file db2jcc_license_cu.jar is no longer needed and change db2jcc.jar to db2jcc4.jar
  3. In using DBeaver, I discovered that when creating a DB2 connection, if the DB2 JDBC driver is not found, it apparently downloads it from Maven Central and saves it so that it will be included in the classpath. It also downloads the POM file which has a link to the license information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants