Com Ibm Db2 Jcc Db2driver Jar Download

I'm trying to add the following db2 jars to my Java web application using Maven...

I'm following the instructions posted in this post...Can I add jars to maven 2 build classpath without installing them?

Installing the IBM DB2 JDBC driver. To integrate the Avaya IR system with an IBM DB2 database, you must install the JDBC driver for DB2. To install the DB2 JDBC driver: Locate the driver file (db2jcc.jar) on the server on which DB2 is installed.

I want to use the static in-project repository solution. So far I have...

  1. Created a folder in my root directory named lib. Inside thisdirectory lives the three db2 jars.
  2. Added the following to my pom file...

But when I run a maven install I get ...

Com.ibm.db2.jcc.db2driver Free Download

I got the version of the Jars by running a...

java com.ibm.db2.jcc.DB2Jcc -version

Have I specified this version info corretly? Can anyone suggest what I am doing wrong?

Community
RichieRichie

3 Answers

The problem is that you didn't install the jars properly in your 'project-maven-repository' (i.e. in the folder ${project.basedir}/lib)

Download

Maven stores (when you do mvn install) the jar files in a maven repository. A maven repository have precise hierarchical structure. Here is a simplified vision of this structure:

  • the artifact groupId+artifactId define the first part of folder path (in the repository) where the artifact is stored.
  • the artifact version is the second part of the folder path
  • the artifact version is also a suffix to the artifact name
  • the artifactId is the artifact name
  • the packaging is the artifact extension (default is jar)

By default maven use a repository located under <USER_HOME>/.m2/repository

The solution you are trying to setup use another location for the repository : ${project.basedir}/lib and even if it is not the default repository location it is still a maven-repository and so maven is expecting to find the usual maven repository hierarchy under this location.

That's why you need to organize your ${project.basedir}/lib folder just like a maven repository. That's explained in this part of the referenced post:

Use Maven to install to project repo

Instead of creating this structure by hand I recommend to use a Maven plugin to install your jars as artifacts. So, to install an artifact to an in-project repository under repo folder execute:

mvn install:install-file -DlocalRepositoryPath=lib -DcreateChecksum=true -Dpackaging=jar -Dfile=[your-jar] -DgroupId=[...] -DartifactId=[...] -Dversion=[...]

If you'll choose this approach you'll be able to simplify the repository declaration in pom to:

So you need to do an mvn install to create the ${project.basedir}/lib hierarchy (you can do it by hand, but it's not recommended and error prone).

I your case, the commands to run will be like this: (assuming you put the jar in your HOME_DIR and run this command in your ${project.basedir})

mvn install:install-file -DlocalRepositoryPath=lib -DcreateChecksum=true -Dpackaging=jar -Dfile=<USER_HOME>/db2jcc_license_cu.jar -DgroupId=com.ibm.db2.jcc -DartifactId=db2jcc_license_cu -Dversion=3.8.47

What are the advantages of the approch you choose :

  • a developer with no maven setup will have the libraries available inside the project sources, under SCM system.
  • you can easily reference jars that aren't in a public maven repository without the need of something like artifactory or nexus

The drawbacks :

  • a quite complex folder structure under ${project.basedir}/lib looking very strange for someone not used to work with maven.
  • you will store the libraries under SCM (lot's of huge binary files)
Community
ben75ben75

Another solution would be to download those jars before hand and put them somewhere relatively to your project (like lib directory). Now just tell maven to use those jars. Here the groupId, artifactdId and version are JFYI since they won't be used to download anything.

The merit of this solution is that you won't have to build a maven repository.

Db2 Jcc Driver

Refer Link (Japanese): Mavenリポジトリで提供されていないサードパーティJarをどうするか

nacho4dnacho4d

Com Ibm Db2 Jcc Db2driver Jar Download 1

I guess these jars do not have a pom.xml. Hence the warning. If the jars get packaged and the application works, then I guess you do not have a problem.

RaghuramRaghuram

Com.ibm.db2.jcc.db2driver Jar File Download

Not the answer you're looking for? Browse other questions tagged maven or ask your own question.