Skip to content

Instantly share code, notes, and snippets.

@MonicaG
Last active September 29, 2016 15:03
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save MonicaG/b53c747c3cc370b0cd70 to your computer and use it in GitHub Desktop.
Save MonicaG/b53c747c3cc370b0cd70 to your computer and use it in GitHub Desktop.
Using Oracle with Spring Boot
If you do not have an oracle driver do steps 1 and 2 first. Otherwise skip to step 3.
1) Download the jdbc driver from oracle.
2) Install the driver into your local maven .m2 repository. Example:
mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.4 -Dpackaging=jar -Dfile=ojdbc6.jar -DgeneratePom=true
In the above example the ojdbc6.jar version 11.2.0.4 is used. Replace the -DartifactId=ojdbc6 -Dversion=11.2.0.4 and -Dfile=ojdbc6.jar with the driver name/version you downloaded.
3) Add the dependency to your build.gradle file. Example:
dependencies {
...
runtime("com.oracle:ojdbc6:11.2.0.4")
...
}
replace driver name and version with the one you downloaded
4) In spring boot add/modify the application.properties file to use your db url, username and password. Example:
spring.datasource.driverClassName=oracle.jdbc.driver.OracleDriver
spring.datasource.url=jdbc:oracle:thin:@127.0.0.1:1521:orcl
spring.datasource.username=username
spring.datasource.password=secret
@igordonin
Copy link

Hi, Monica!
I'm hitting an issue I can't find a solution for. Any chance you have some insights? Any help will be appreciated.
I'm sure this is a silly configuration issue as I'm just starting to learn Spring...
Anyways, I created a gist, if you'd be so kind as to take a look.
C ya

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment