title: How to connect Spring to Oracle Database using eclipse IDE.
body: <p>I couldn't connect the spring application with oracle db (12c). I have installed the jdbc8 (java to oracle driver) locally and installed all the spring and jdbc dependencies. </p>
  
  <p>Can anyone please help me with it. I'm unable to run the application (access and update the database ). maven build was successful and compilation was sucessful. </p>
  
  <p>Steps I followed to run the application: 
  1) build as maven clean. 
  2) run the application. (not on apache)</p>
  
  <p>****console log: 
  Oracle 12.2.0.1.0 JDBC 4.2 compiled with javac 1.8.0_91
  ***** JCE UNLIMITED STRENGTH IS INSTALLED ********</p>
  
  <p>Code for contact.java</p>
  
  <pre><code>package net.codejava.spring;
  
   /**
   * 
   * @author www.codejava.net
    *
     */
      public class Contact {
      private String name;
      private String email;
      private String address;
      private String phone;
  
      public String getName() {
      return name;
  }
  
  public void setName(String name) {
      this.name = name;
  }
  
  public String getEmail() {
      return email;
  }
  
  public void setEmail(String email) {
      this.email = email;
  }
  
  public String getAddress() {
      return address;
  }
  
  public void setAddress(String address) {
      this.address = address;
  }
  
  public String getPhone() {
      return phone;
  }
  
  public void setPhone(String telephone) {
      this.phone = telephone;
  }
  
  public String toString() {
      return String.format("[%s - %s - %s - %s]", name, email, address, phone);
  }
  </code></pre>
  
  <p>}</p>
  
  <p>code for SpringJDBCTemplateExmaple.java</p>
  
  <pre><code>    package net.codejava.spring;
  
      import java.sql.ResultSet;
      import java.sql.SQLException;
      import java.util.List;
  
      import org.springframework.jdbc.core.JdbcTemplate;
      import org.springframework.jdbc.core.RowMapper;
      import org.springframework.jdbc.datasource.SimpleDriverDataSource;
  
       /**
      * This console application demonstrates how to do CRUD operations using              JDBC
      * with Spring framework.
      * @author www.codejava.net
       *
       */
      public class SpringJDBCTemplateExample {
  
  public static void main(String[] args) throws SQLException {
      SimpleDriverDataSource dataSource = new SimpleDriverDataSource();
      dataSource.setDriver(new oracle.jdbc.OracleDriver());
      dataSource.setUrl("jdbc:oracle:thin:@localhost:1521:ORCL");
      dataSource.setUsername("system");
      dataSource.setPassword("Welcome1");
  
      JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
  
      String sqlInsert = "INSERT INTO contact (name, email, address, telephone)"
              + " VALUES (?, ?, ?, ?)";
      jdbcTemplate.update(sqlInsert, "Tom", "tomea@mail.com", "USA", "12345");
  
      String sqlUpdate = "UPDATE contact set email=? where name=?";
      jdbcTemplate.update(sqlUpdate, "tomee@mail.com", "Tom");
  
      String sqlSelect = "SELECT * FROM contact";
      List&lt;Contact&gt; listContact = jdbcTemplate.query(sqlSelect, new RowMapper&lt;Contact&gt;() {
  
          public Contact mapRow(ResultSet result, int rowNum) throws SQLException {
              Contact contact = new Contact();
              contact.setName(result.getString("name"));
              contact.setEmail(result.getString("email"));
              contact.setAddress(result.getString("address"));
              contact.setPhone(result.getString("telephone"));
  
              return contact;
          }
  
      });
  
      for (Contact aContact : listContact) {
          System.out.println(aContact);
      }
  
      String sqlDelete = "DELETE FROM contact1 where name=?";
      jdbcTemplate.update(sqlDelete, "Tom");
  }
  </code></pre>
  
  <p>}</p>
  
  <p>code for pom.xml </p>
  
  <pre><code>       &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;groupId&gt;net.codejava.spring&lt;/groupId&gt;
  &lt;artifactId&gt;SpringJDBCTemplateExample&lt;/artifactId&gt;
  &lt;version&gt;1.0&lt;/version&gt;
  &lt;name&gt;SpringJDBCTemplateExample&lt;/name&gt;
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-jdbc&lt;/artifactId&gt;
          &lt;version&gt;4.0.3.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.oracle&lt;/groupId&gt;
          &lt;artifactId&gt;ojdbc8&lt;/artifactId&gt;
          &lt;version&gt;12.1.0.1&lt;/version&gt;     
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p></p>
  
  <p>contact table: </p>
  
  <pre><code>         CREATE TABLE contact (
             contact_id integer NOT NULL,
             name varchar(45) NOT NULL,
             email varchar(45) NOT NULL,
             address varchar(45) NOT NULL,
             telephone varchar(45) NOT NULL,
             CONSTRAINT contact_pk PRIMARY KEY (contact_id)
              ); 
  </code></pre>