Arnab
Arnab

Reputation: 195

How to use oracle driver in a spring boot app and deploy using docker

I am trying to connect my spring boot application to Oracle using ojdbc driver. Locally I have added the required dependencies as -

<dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc</artifactId>
            <version>8</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/lib/ojdbc8.jar</systemPath>
        </dependency>

However when the app is deployed, the driver class is not found. What changes are required to deploy the app in different environments?

Upvotes: 1

Views: 781

Answers (2)

Panagiotis Bougioukos
Panagiotis Bougioukos

Reputation: 19118

Just a recent feedback from changes of Spring Boot Version 2.6 and later versions .If you have used

    <dependency>
        <groupId>com.oracle.ojdbc</groupId>
        <artifactId>ojdbc8</artifactId>
    </dependency>

before spring boot version 2.6 you would have retrieved automatically the version of the above artifact from spring boot parent via dependency management.

This is no longer the case and from now to achieve the same you would have to change the above dependency into

    <dependency>
        <groupId>com.oracle.database.jdbc</groupId>
        <artifactId>ojdbc8</artifactId>
    </dependency>

Upvotes: 0

vbezhenar
vbezhenar

Reputation: 12356

Try

<dependency>
    <groupId>com.oracle.ojdbc</groupId>
    <artifactId>ojdbc8</artifactId>
    <version>19.3.0.0</version>
</dependency>

Upvotes: 3

Related Questions