Giter Site home page Giter Site logo

karunakarreddya / spring-boot-oracle-example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shawn-mcginty/spring-boot-oracle-example

0.0 0.0 0.0 9 KB

A quick example of getting Oracle JDBC to work with springboot RESTful application

PLSQL 21.85% Java 67.88% Shell 10.27%

spring-boot-oracle-example's Introduction

Springboot with Oracle DB Example

Quick example of using springboot to write a quick REST API to access some stuff in an Oracle database.

Steps to make this garbage work

Prereqs

  1. Java 8
  2. Maven (because reasons)
  3. Vagrant: https://www.vagrantup.com/
  4. Clone this repo (duh)

Install/Configure Oracle express

  1. Oracle xe installer for linux (I don't care if you're running linux or not, this guy is going in a VM): http://www.oracle.com/technetwork/database/database-technologies/express-edition/downloads/index.html
  2. Move that guy to spring-boot-oracle-example/oracle-installer
  3. vagrant up (in the spring-boot-oracle-example dir)
  4. Congrats, oracle xe is installed(ish) on this VM
  5. vagrant ssh
  6. sudo -i (act as root)
  7. You'll note from the step above after running vagrant up you'll see a message, something like ==> default: You must run '/etc/init.d/oracle-xe configure' as the root user to configure the database. So yeah.. do that.
  8. Use the default ports. And take not of the password you provide.
  9. . /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh - Set env variables using the script provided from Oracle. This is needed to connect using their sql client.
  10. sqlplus /nolog
  11. connect sys as sysdba
  12. Enter the password you created during config
  13. start /vagrant/create_sql_user_and_tables.sql

Oracle JDBC Driver shenanigans

  1. Download the JDBC driver: http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html
  2. Here's where things get interesting. Apparently gradle can't load this jar from a flatFile repository. So the workaround is to create a local maven repository and load this 1 jar into it.
  3. cd to the directory where the ojdbc jar is located
  4. mvn install:install-file -Dfile=ojdbc6.jar -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.4 -Dpackaging=jar
  5. In the above command make sure to adjust the file, artifactId, and version to match the driver you downloaded.
  6. If a different version from the one above was used adjust build.gradle

Run it!

  1. ./gradlew bootRun
  2. http://localhost:8080/users

spring-boot-oracle-example's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.