Find Oracle JDBC driver in Maven repository
How do I find a repository (if any) that contains this artifact?
Unfortunately due the binary license there is no public repository with the Oracle Driver JAR. This happens with many dependencies but is not Maven's fault. If you happen to find a public repository containing the JAR you can be sure that is illegal.
How do I add it so that Maven will use it?
Some JARs that can't be added due to license reasons have a pom entry in the Maven Central repo. Just check it out, it contains the vendor's preferred Maven info:
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.3.0</version>
...and the URL to download the file which in this case is
http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html.
Once you've downloaded the JAR just add it to your computer repository with (note I pulled the groupId, artifactId and version from the POM):
mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc14 \
-Dversion=10.2.0.3.0 -Dpackaging=jar -Dfile=ojdbc.jar -DgeneratePom=true
The last parameter for generating a POM will save you from pom.xml warnings
If your team has a local Maven repository this guide might be helpful to upload the JAR there.
gradle: could not find oracle jdbc jar from maven repository
see https://www.oracle.com/database/technologies/maven-central-guide.html
it should be
implementation 'com.oracle.database.jdbc:ojdbc8:12.2.0.1'
java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver when using Maven Dependency
I resolved the issue by adding the corresponding ojdbc.jar to the project.
It can be resolved by adding the mentioned maven dependency too (mentioned by Joy).
problems trying to install ojdbc7 as a maven dependency
Add the Repository to your POM and it will work:
<repositories>
<repository>
<id>hand-china-repo</id>
<name>HandChinaRepo</name>
<url>http://nexus.saas.hand-china.com/content/repositories/rdc/</url>
</repository>
</repositories>
The repo is listed on the Maven Repository page:
https://mvnrepository.com/artifact/com.oracle/ojdbc7/12.1.0.2
Maven Central is reporting a similar dependency at version 12.1.0.2. Try changing your POM to match:
<!-- https://mvnrepository.com/artifact/com.oracle/ojdbc7 -->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2</version>
</dependency>
I tested and this combination of adding the repo and the exact version works for me.
Maven: Oracle JDBC driver
Due to binary licences , the Oracle driver is not present in the maven central repository. You can find some public repos that have hosted this jar to be made available for use but it is illegal as per the license.
it is obviously finding the jar file and downloading it as it is in my .m2 folder
There can be reasons why that jar is there ( or atleast you think it is )
- Whenever maven fails to find some jar ( due to any reason whatsoever ) , it does generate the maven2 hierarchy of folders in the .m2/ but if you look closely you will notice that its not exactly a jar , but its extension will be like "someJarName.1.1.1.jar.lastUpdated". This is not a jar, this is just a convention used by maven to keep track of what jars it needs to re-download and re-check
- The second possibility is that the jar must have been manually inserted into the repository ( by the mvn
install:install-file
command and that is the reason its there. of-course I am assuming the fact that you haven't configured any other repository besides the default mvn central
If you have the jar file in your local m2 repo ( I suggest you verify by expanding it, making sure all its package contents are in order and also the size of the jar ) then you may have to tell Eclipse to look for the jar again. To do this goto Window -> Preferences -> Maven -> User settings -> hit the re-index button and wait for a couple of minutes . And then see if this helps solve your problem
Edit
Another possible solution would be to use the system
scope and specify the path of the jar on the local machine , although I highly discourage this.
I need to add Oracle JDBC driver in Maven local repository
Please check that "path/to/your/ojdbc8.jar" doesn't not have spaces or special characters or "quote" it.
Not able to find ojdbc driver after adding it in the pom.xml file
Please note that mvnrepository has nothing to do with MavenCentral.
When you find an artifact there, it does not mean that Maven will find it in MavenCentral.
Instead, you need to figure out a repository from which you can get the desired jar and then add that repository to your <repositories>
.
For the specific jar, this might be difficult, see here (as already suggested by Ben R.):
Find Oracle JDBC driver in Maven repository
Oracle JDBC ojdbc6 Jar as a Maven Dependency
The correct answer was supplied by Raghuram in the comments section to my original question.
For whatever reason, pointing "mvn install" to a full path of the physical ojdbc6.jar file didn't work for me. (Or I consistently repeatedly flubbed it up when running the command, but no errors were issued.)
cd-ing into the directory where I keep ojdb6.jar and running the command from there worked the first time.
If Raghuram would like to answer this question, I'll accept his answer instead. Thanks everyone!
Maven Build Not Finding Oracle
It turns out Oracle JDBC drivers need to be obtained from the "Oracle Maven Repository". There's lots of guidance on that, which I guess I missed at first. They can also be downloaded directly.
Related Topics
How to Check If an App Running on Android
Understand the R Class in Android
How to Know Whether Enough Memory Is Free to Deploy a New Application on a Linux MAChine
How to Use Chef to Update-Alternatives for Java Using Execute
How Does a Jvm Process Allocate Its Memory
Certificateexception: No Subject Alternative Names Present
How to Add Multiple Jar Files in Classpath in Linux
Compound Class Names Are Not Supported Error in Webdriver
How to Use the Legacy Apache Http Client on Android Marshmallow
Execute a Linux Terminal Command in Java
Too Many Open Files Error But Lsof Shows a Legal Number of Open Files