Am trying to use jdbc connection in my Java EE6 application(class name VisualizerRepository.java), i have the jdbc driver in nexus repository
The c
Oracle JDBC drivers are accessible from Oracle Maven Repository with some additional security related steps.
Check the blog "Get Oracle JDBC drivers and UCP from Oracle Maven Repository (without IDEs)" for more details.
The maven command that resides in answer
(meanwhile it was taken from http://www.mkyong.com/maven/how-to-add-oracle-jdbc-driver-in-your-maven-local-repository/) did not work for me. But after removing {}
characters, everything is fine:
mvn install:install-file -Dfile=Path/to/your/ojdbc.jar -DgroupId=com.oracle
-DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar
Also don't forget to add version number to the name of jar file like ojdb6-11.2.0.jar
The ojdbc jar is not in public maven repositories. You can add the jar to local repository manually.
Download the jar from:
Install in your repository
mvn install:install-file -Dfile={Path/to/your/ojdbc.jar} -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar
Use in your pom
<dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc6</artifactId> <version>11.2.0</version> </dependency>
I tried to get gradle to pull the jar from my local maven repo and even using flatDir
in the repositories
closure, but to no effect. In the end, I created a lib
folder in my project and put the jar in it and added
dependencies {
...
compile files('lib/ojdbc7.jar')
...
}
I don't think this is the prettiest way to handle it, but it worked, and it's good enough for now.
I faced a similar scenario where exception was following.
java: cannot access oracle.jdbc.OracleTypes error
I manually installed ojdbc JAR to my local repository. However the problem was still existing. It was because I installed ojbc10.jar. For some reasons I thought number in this JAR name is like JDBC version. But they are more related with Java version. My project was using Java JDK 8. So issue got resolved after installing ojdbc8.jar.
So when you download make sure to check the release note. Certified with JDK8, JDK9, JDK11.