L.Anush
L.Anush

Reputation: 101

How to configure Oracle to Spring boot application

I want to set up spring boot latest project with the Oracle database. i did fw steps 1. Download ojdbc7 12.1.0.1 jar and keep it in "C:\Users\Dasun_09323.m2\repository\com\oracle\ojdbc7".

2.using maven command i installed that jar. 3.added this gradle dependency, compile group: 'cn.easyproject', name: 'ojdbc7', version: '12.1.0.1'.

Than i open the terminal in intelliJ idea and hit gradle build -x test to build the project but BUILD FAILED ..

Execution failed for task ':compileJava'.

Could not resolve all files for configuration ':compileClasspath'. Could not find cn.easyproject:ojdbc7:12.1.0.1. Required by: project :

How to fix this issue ? this ate my 3 days of working.

Upvotes: 1

Views: 1612

Answers (4)

Gianluca Musa
Gianluca Musa

Reputation: 805

Add repository on your project' pom file, in the repositories tag:

  <repository>
        <id>ICM</id>
        <name>ICM project repository</name>
        <url>https://mvnrepository.com/artifact/repo</url>
  </repository>

Upvotes: 0

L.Anush
L.Anush

Reputation: 101

I just created a directory called Lib and upload oracle driver jar into it. then i removed the dependency for the oracle and i just added. this line in under the dependency corner.

compile fileTree(include: ['*.jar'], dir: 'lib')

Upvotes: 0

J.D
J.D

Reputation: 452

Gradle

dependencies {
    compile("org.springframework.boot:spring-boot-starter-data-jpa")

}

Maven

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
            <version>1.5.3.RELEASE</version>
        </dependency>

to use CrudRepository more info here https://docs.spring.io/spring-data/data-commons/docs/1.6.1.RELEASE/reference/html/repositories.html

in your application properties

# Oracle settings

spring.datasource.url=jdbc:oracle:thin:@localhost:1522:orcl

spring.datasource.username=HIBERNATE_TEST

spring.datasource.password=HIBERNATE_TEST

spring.datasource.driver.class=oracle.jdbc.driver.OracleDriver

here is a good article on dzone https://dzone.com/articles/spring-boot-jpa-hibernate-oracle

Using the oracle driver is answered in this post How to use Oracle JDBC driver in Gradle project

Upvotes: 0

Avinash Singh
Avinash Singh

Reputation: 3797

Based on the error it looks like you have not added the entry in your .m2 correctly.

Verify that the jar exists in :\Users\Dasun_09323.m2\repository\cn\easyproject

If it exists then you can get the entries from pom.xml file in the dependency and make sure it matches what you are using in gradle.

Upvotes: 1

Related Questions