I am using Eclipse Luna and working on a maven project. When I add the entry for ojdbc jar in pom.xml , it is giving error in the xml. I can't find any reason for the issue as groupId, artifactId and version are correct.
How can I fix the problem?
I am using Eclipse Luna and working on a maven project. When I add the entry for ojdbc jar in pom.xml , it is giving error in the xml. I can't find any reason for the issue as groupId, artifactId and version are correct.
How can I fix the problem?
Due to Oracle license restriction, there are no public repositories that provide ojdbc jar.
You need to download it and install in your local repository. Get jar from Oracle and install it in your local maven repository using
mvn install:install-file -Dfile={path/to/your/ojdbc.jar} -DgroupId=com.oracle
-DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar
If you are using ojdbc7, here is the link
This is the quickest way to solve the problem but it's not recommended because its applicable only for your local system.
Download the jar, comment your previous entry for ojdbc6
, and give a new local entry like so:
Previous Entry:
<!-- OJDBC6 Dependency -->
<!-- <dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>1.0</version>
<scope>runtime</scope>
</dependency> -->
New Entry:
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/ojdbc6/ojdbc6.jar</systemPath>
</dependency>
Place ojdbc6.jar in your project resources folder of eclipse. then add the following dependency code in your pom.xml
<dependency>
<groupId> oracle </groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/ojdbc6.jar</systemPath>
</dependency>
Download the oracle ojdbc driver from Oracle official website.
Install/Add Oracle driver to the local maven repository mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc7 -Dpackaging=jar -Dversion=12.1.0.1 -Dfile=ojdbc7.jar -DgeneratePom=true
Specify the downloaded file location via -Dfile=
Add the following dependency in your pom file
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.1</version>
</dependency>
Use the same groupId/artifactId as specified in your mvn install command. Finally clean your project.
You might have problem on Windows while adding jar to maven because of syntax.
Try encapsulating -D parameters with double quotas like this;
mvn install:install-file "-Dfile=ojdbc6.jar" "-DgroupId=com.oracle" "-DartifactId=ojdbc6" "-Dversion=11.2.0" "-Dpackaging=jar"
Be aware of you should use same version/atifactId/groupId inside your pom.xml. You can't use version 11.2.0.3 after command above. You have to put his in you pom.xml;
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0</version>
</dependency>
If you want to use another version, like 12.1.0.1, you should run above command with that version or other info
I had the same issue. Jenkins's build was falling because of this error..after long hours troubleshooting.
Link to download ojdbc as per your requirement - https://www.oracle.com/database/technologies/maven-central-guide.html
I have downloaded in my maven/bin location and executed the below command.
mvn install:install-file -Dfile=ojdbc8-12.2.0.1.jar -DgroupId=com.oracle -DartifactId=ojdbc8 -Dversion=12.2.0.1 -Dpackaging=jar
POM.xml
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc8</artifactId>
<version>12.2.0.1</version>
</dependency>
Add this is work for me
<repositories>
<!-- Repository for ORACLE JDBC Driver -->
<repository>
<id>codelds</id>
<url>https://code.lds.org/nexus/content/groups/main-repo</url>
</repository>
</repositories>
It's due to the missing of ojdbc6.jar in the maven repository. download it Click Here
Add the dependency in the pom.xml file
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0</version>
</dependency>
Install/Add Oracle driver to the local maven repository using the following command in command prompt.
cd C:\Users\Public\Documents\apache-maven-3.5.2\bin
type the command
mvn install:install-file -Dfile={path/to/your/ojdbc.jar} -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar
Eg: mvn install:install-file -Dfile=C://Users//Codemaker//Downloads//Compressed//ojdbc6.jar -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar
NB: use double back slash to seperate folders (//)
You need to check your config file if it has correct values such as systempath and artifact Id.
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>C:\Users\Akshay\Downloads\ojdbc6.jar</systemPath>
</dependency>
Sometimes even though the jar is available in the folder the error will not go way to overcome this just change a group id to a meaningful one.
try this one
<dependency>
<groupId>com.hynnet</groupId>
<artifactId>oracle-driver-ojdbc6</artifactId>
<version>12.1.0.1</version>
</dependency>
oracle driver. `
<dependency>
<groupId>com.hynnet</groupId>
<artifactId>jdbc-fo</artifactId>
<version>12.1.0.2</version>
</dependency>
`
© 2022 - 2024 — McMap. All rights reserved.