title: Spring security authentication simple login
body: <p>I have the following configured in my app-config.xml:</p>
  
  <pre><code>&lt;security:http auto-config="true" /&gt;
      &lt;security:global-method-security secured-annotations="enabled" /&gt;
  
      &lt;security:authentication-manager&gt;
          &lt;security:authentication-provider&gt;
              &lt;security:jdbc-user-service data-source-ref="dataSource"
  
                  users-by-username-query="
                    select login, password 
                    from accounts where login=? and password=?" 
  
                  authorities-by-username-query="
                    select a.login, ar.authority from accounts a, account_roles ar 
                    where a.account_id = ar.account_id and a.login =?  " 
  
              /&gt;
          &lt;/security:authentication-provider&gt;
      &lt;/security:authentication-manager&gt;
  </code></pre>
  
  <p>However When I start my application, and it displays the login for I get the following error message:</p>
  
  <blockquote>
    <p>Reason: PreparedStatementCallback; uncategorized SQLException for SQL [select login, > password from accounts where login=? and
    password=?]; SQL state [90012]; error code [90012]; Parameter "#2" is
    not set; SQL statement: select login, password from accounts where
    login=? and password=? [90012-170]; nested exception is
    org.h2.jdbc.JdbcSQLException: Parameter "#2" is not set; SQL
    statement: select login, password from accounts where login=? and
    password=? [90012-170]</p>
  </blockquote>
  
  <p>Any ideas whats wrong?</p>
  
  <p>I am not totally sure how the security:jdbc-user-service works? How does it fill in the = in my select query?</p>
  
  <p>My database is defined as:</p>
  
  <pre><code>CREATE TABLE accounts (
    account_id VARCHAR NOT NULL,
    login VARCHAR NOT NULL,
    password VARCHAR NOT NULL,
    PRIMARY KEY (account_id)
  );
  CREATE TABLE account_roles (
    account_id VARCHAR NOT NULL,
    authority VARCHAR NOT NULL,
    PRIMARY KEY (account_id),
    CONSTRAINT FK_account_roles FOREIGN KEY (account_id) REFERENCES accounts (account_id)
  );
  </code></pre>
  
  <p>Thanks</p>