DEV Community


Spring boot REST API with Oracle database

Software Engineer - Founder at
・2 min read

Spring boot REST API with Oracle database

How to connect Oracle database with spring Boot? It is the one of most common questions for developers. So in the post "Spring boot REST API with Oracle database", I will help you to try it with Spring JPA. Here is a to do list for the tutorial:

  • Overview of Project Structure
  • Create SpringBoot with Spring Data JPA and Oracle dependencies
  • Configuration SpringBoot to connect to Oracle
  • Define a data model to map with table's columns in Oracle database
  • Define a JPA Repository to do CRUD operations
  • Use CommandLineRunner to excute above JPA Repository APIs: save, retrieve, update, detele entities

To do the tutorial, you need prepare Java >= 1.8, Spring Tool Suite in local computer for development.

Let's go !

SpringBoot Project Overview - Spring boot REST API with Oracle database

[caption id="attachment_56" align="alignnone" width="378"]Spring boot REST API with Oracle database-Overview-How-to-Integrate-Springboot-2.x-with-postgresql-using-Spring-JPA Project Overview How to Integrate Springboot 2.x with Oracle using Spring JPA[/caption]

In the SpringBoot application, we use Spring JPA to connect and manipulate the data between Application and Oracle database. We define a repository to do CRUD operations (save, retrieve, update, delete) with entities. And for mapping the data between Spring Application with database table's columns, we define a model class.

Create SpringBoot Project

We use Eclipse that had integrated with SpringToolSuite to create a SpringBoot project. Remember we need add 2 dependencies Spring Data JPA and Oracle driver.

Checking pom.xml file we see the needed dependencies as below:

<!-- Oracle Driver -->

Spring boot REST API with Oracle database

Discussion (0)

Forem Open with the Forem app