Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding DB2 JDBC Driver via Maven

Tags:

java

maven

jdbc

db2

I am trying to connect to a DB2 database via the JDBC driver. I added the following entry in my pom.xml

<!-- https://mvnrepository.com/artifact/com.ibm.db2/db2jcc_license_cu -->
<dependency>
    <groupId>com.ibm.db2</groupId>
    <artifactId>db2jcc_license_cu</artifactId>
    <version>9.7</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.ibm.db2/db2jcc -->
<dependency>
    <groupId>com.ibm.db2</groupId>
    <artifactId>db2jcc</artifactId>
    <version>8.1</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.ibm.db2.jcc/db2jcc4 -->
<dependency>
    <groupId>com.ibm.db2.jcc</groupId>
    <artifactId>db2jcc4</artifactId>
    <version>10.1</version>
</dependency>

But the maven build is failing with the following issue

   [INFO] Downloading from : https://repo.maven.apache.org/maven2/com/ibm/db2/db2jcc_license_cu/9.7/db2jcc_license_cu-9.7.pom
    [WARNING] The POM for com.ibm.db2:db2jcc_license_cu:jar:9.7 is missing, no dependency information available
    [INFO] Downloading from : https://repo.maven.apache.org/maven2/com/ibm/db2/db2jcc/8.1/db2jcc-8.1.pom
    [WARNING] The POM for com.ibm.db2:db2jcc:jar:8.1 is missing, no dependency information available
    [INFO] Downloading from : https://repo.maven.apache.org/maven2/com/ibm/db2/jcc/db2jcc4/10.1/db2jcc4-10.1.pom
    [WARNING] The POM for com.ibm.db2.jcc:db2jcc4:jar:10.1 is missing, no dependency information available
[ERROR] Failed to execute goal on project <somename>: Could not resolve dependencies for project

How should I add the dependency for DB2 driver in maven?

like image 303
sovan Avatar asked Oct 22 '25 08:10

sovan


1 Answers

The DB2 java driver (Type 4 JDBC connector) has now (really for real) been published to maven central:

https://mvnrepository.com/artifact/com.ibm.db2/jcc

Include it as a dependency like so:

<!-- https://mvnrepository.com/artifact/com.ibm.db2/jcc -->
<dependency>
    <groupId>com.ibm.db2</groupId>
    <artifactId>jcc</artifactId>
    <version>11.1.4.4</version>
</dependency>
like image 103
ebullient Avatar answered Oct 23 '25 21:10

ebullient



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!