title: debug spring security authentication-manager
body: <p>I'm trying to get Spring security using an example from the mykong website...<br>
  <a href="http://www.mkyong.com/spring-security/spring-security-form-login-using-database/" rel="nofollow noreferrer">http://www.mkyong.com/spring-security/spring-security-form-login-using-database/</a></p>
  
  <p>I had it working using a simple MySQL table but now I'm trying to get it to work using db2 where the passwords are stored in the database encrypted with md5.</p>
  
  <p>Here is how I have set up...</p>
  
  <pre><code>&lt;authentication-manager&gt;
      &lt;authentication-provider&gt;
          &lt;password-encoder hash="md5" /&gt;
          &lt;jdbc-user-service data-source-ref="dataSource"
  
              users-by-username-query="
                  select employeenumber, employeepassword 
                  from employee where employeenumber like ? 
                  and employeestatus = 'Active'"
  
              authorities-by-username-query="
                  select employeenumber, securitygroupcode 
                  from employee 
                  where employeenumber like ? 
                  and employeestatus = 'Active'" 
          /&gt;
      &lt;/authentication-provider&gt;
  &lt;/authentication-manager&gt;
  </code></pre>
  
  <p>When I try and log in to my app and I enter incorrect login details it correctly tells me...</p>
  
  <p>Your login attempt was not successful, try again.
  Caused: Invalid username or password </p>
  
  <p>But when I login correctly I enter correct login details I get...</p>
  
  <p>Your login attempt was not successful, try again.
  Caused : PreparedStatementCallback; uncategorized SQLException for SQL [select employeenumber as username, employeepassword as password from epos.employee where employeenumber like ? and sitedirectoryid = 10001 and employeestatus = 'Active']; SQL state [null]; error code [-99999]; [ibm][db2][jcc][10145][10897] Invalid parameter 3: Parameter index is out of range.; nested exception is com.ibm.db2.jcc.b.SqlException: [ibm][db2][jcc][10145][10897] Invalid parameter 3: Parameter index is out of range. </p>
  
  <p>thanks all</p>