title: Reason: PreparedStatementCallback; bad SQL grammar
body: <p>I've been trying to use a Postgres database for authentication with Spring security.</p>
  
  <p>This is my SQL table definition:</p>
  
  <pre><code>CREATE TABLE "UTILISATEUR" (
  "IdUtilisateur" serial NOT NULL,
  "Nom" character varying(50),
  "Prenom" character varying(50),
  "Profil" character varying(50),
  "Pseudo" character varying(20),
  "IdSite" integer DEFAULT 0,
  "Password" character varying(1024),
  role character varying(45),
  CONSTRAINT "UTILISATEUR_pkey" PRIMARY KEY ("IdUtilisateur"),
  CONSTRAINT fk1u FOREIGN KEY (role)
     REFERENCES "Role" (role) MATCH SIMPLE
     ON UPDATE NO ACTION ON DELETE NO ACTION
  );
  </code></pre>
  
  <p>And here's my configuration class for spring security:</p>
  
  <pre><code>package com.ardia.MDValidation;
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
  import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
  import org.springframework.security.config.annotation.web.builders.HttpSecurity;
  import org.springframework.security.config.annotation.web.builders.WebSecurity;
  import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
  import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
  import javax.sql.DataSource ;
  
  @Configuration
  @EnableWebSecurity
  @EnableGlobalMethodSecurity
  public class SecurityConfig extends WebSecurityConfigurerAdapter {
      //Pour l'authentification des Utilisateur de Table Utilisateur
  @Autowired  
  public void GlobalConfig(AuthenticationManagerBuilder auth,DataSource dataSource) throws Exception {
    auth.jdbcAuthentication()
      .dataSource(dataSource)
          .usersByUsernameQuery("select Pseudo as principal , Password as credentials from UTILISATEUR where Pseudo = ? ")
              .authoritiesByUsernameQuery("select Pseudo as principal , role as role from UTILISATEUR where Pseudo = ? ")
                  .rolePrefix("_ROLE");
  }
      //ne pas appliqué la securité sur les ressources 
  @Override
  public void configure(WebSecurity web) throws Exception {
      web.ignoring()
      .antMatchers("/bootstrap/css/**","/css/**");
  }
  @Override
  protected void configure(HttpSecurity http) throws Exception {
  http
  
      .csrf().disable()   
      .authorizeRequests()
      .anyRequest()   
          .authenticated()        
              .and()
              .formLogin()
              .permitAll();
  }
  
  }
  </code></pre>
  
  <p>It used to work with in memory users. Now I can't make it work is because SQL grammar. Or should I change the table name because in the error the username is lower case and my table name is upper case?</p>
  
  <p>Here's the error:</p>
  
  <pre><code>org.postgresql.util.PSQLException: ERREUR: la relation « utilisateur » n'existe pas Position : 32
  </code></pre>
  
  <p><strong>I Found The Problem</strong> </p>
  
  <p>It seems when you execute a query with <code>jdbcAuthentication()</code> it forces column and table names to lower case. Does anyone know how to change that?</p>