title: org.postgresql.util.PSQLException: ERROR: relation "employee" does not exist Position: 13
body: <p>I am trying to change the database from MySQL to PostgreSQL from the tutorial given on <a href="https://javainspires.blogspot.com/2020/07/spring-boot-2-spring-data-jdbc-jdbc.html" rel="nofollow noreferrer">https://javainspires.blogspot.com/2020/07/spring-boot-2-spring-data-jdbc-jdbc.html</a>. I am constantly having the error shown in the title.</p>
  <p><strong>Employee.java</strong></p>
  <pre><code>package com. example.demo;
  
  import javax.persistence.Entity;
  import javax.persistence.Table;
  
  public class Employee {
  
      private String username;
      private String email;
      private String password;
  
      public Employee() {
          super();
          // TODO Auto-generated constructor stub
      }
  
      public Employee(String username, String email, String password) {
          super();
          this.username = username;
          this.email = email;
          this.password = password;
      }
  
      public String getUsername() {
          return username;
      }
  
      public void setUsername(String username) {
          this.username = username;
      }
  
      public String getEmail() {
          return email;
      }
  
      public void setEmail(String email) {
          this.email = email;
      }
  
      public String getPassword() {
          return password;
      }
  
      public void setPassword(String password) {
          this.password = password;
      }
  
  }
  </code></pre>
  <p><strong>EmployeeController</strong></p>
  <pre><code>package com. example.demo;
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.jdbc.core.JdbcTemplate;
  import org.springframework.stereotype.Controller;
  import org.springframework.web.bind.annotation.PostMapping;
  
  @Controller
  public class EmployeeController {
  
      @Autowired
      JdbcTemplate jdbcTemplate;
      
      @PostMapping(path = &quot;addUser&quot;)
      public String addUser(Employee user) {
          
          String insert_query = &quot;INSERT INTO employee (username,email,password) VALUES(?,?,?)&quot;; 
          
          int rows = jdbcTemplate.update(insert_query,
                  user.getUsername(), 
                  user.getEmail(),
                  user.getPassword());
          
          if(rows == 1) {
              return &quot;success&quot;; 
          } else {
              return &quot;error&quot;; 
          }
                  
      
      }
      
  }
  </code></pre>
  <p><strong>Html Files:
  index.html</strong></p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html xmlns:th=&quot;http://www.thymeleaf.org&quot;&gt;
  &lt;head&gt;
  &lt;meta charset=&quot;ISO-8859-1&quot;&gt;
  &lt;title&gt;Java Inspires&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
   &lt;form th:action=&quot;@{/addUser}&quot; th:object=&quot;${user}&quot; method=&quot;post&quot; &gt;
   
    &lt;p&gt;User Name :&lt;input type=&quot;text&quot; name=&quot;username&quot; /&gt;&lt;/p&gt;
    &lt;p&gt;Email :&lt;input type=&quot;email&quot; name=&quot;email&quot; /&gt;&lt;/p&gt;
    &lt;p&gt;Password :&lt;input type=&quot;password&quot; name=&quot;password&quot; /&gt;&lt;/p&gt;
    &lt;p&gt;&lt;input type=&quot;submit&quot; value=&quot;Sign Up&quot; /&gt;&lt;/p&gt;
   &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p><strong>Application.properties</strong></p>
  <pre><code>spring.datasource.url=jdbc:postgresql://localhost:5432/database
  spring.datasource.username=postgres
  spring.datasource.password=admin
  spring.datasource.driver-class-name=org.postgresql.Driver
  </code></pre>
  <p><strong>schema.sql</strong></p>
  <pre><code>CREATE TABLE employee
  (
      username varchar(100) NOT NULL, 
      email varchar(100) NOT NULL,
      password varchar(100) NOT NULL
  ); 
  </code></pre>
  <p>pom.xml</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
      xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;2.4.3&lt;/version&gt;
          &lt;relativePath/&gt; &lt;!-- lookup parent from repository --&gt;
      &lt;/parent&gt;
      &lt;groupId&gt;com.example&lt;/groupId&gt;
      &lt;artifactId&gt;JDBC&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;name&gt;JDBC&lt;/name&gt;
      &lt;description&gt;Demo project for Spring Boot&lt;/description&gt;
      &lt;properties&gt;
          &lt;java.version&gt;11&lt;/java.version&gt;
      &lt;/properties&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-jdbc&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-thymeleaf&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-tomcat&lt;/artifactId&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.postgresql&lt;/groupId&gt;
              &lt;artifactId&gt;postgresql&lt;/artifactId&gt;
              &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>