title: need to configure an old JDBCRealm for tomcat webapp with oracle database
body: <p>I am trying to resurrect some  old java webapps but lost my old glassfish config files in which my JDBCRealm was defined.  Now I am trying to deploy the old war's to Tomcat 7 and need to recreate the JDBCRealm to authenticate users.  It's been so long since I worked on this stuff I can't remember how to do it, I looked a the official doc but it lacks a connectionURL for oracle.  I think my database is set up as before with the users and roles table.</p>
  
  <p>Can I even reuse the old war that ran on glassfish 3 on Tomcat 7?  It contains a sun-web.xml file. Is that just for glassfish?</p>
  
  <p>I am using form auth method - here is s  snippet of my web.xml: </p>
  
  <pre><code> &lt;login-config&gt;
  &lt;auth-method&gt;FORM&lt;/auth-method&gt;
  &lt;realm-name&gt;jdbc/myapp/realm&lt;/realm-name&gt;
  &lt;form-login-config&gt;
    &lt;form-login-page&gt;/loginPage.jsp&lt;/form-login-page&gt;
    &lt;form-error-page&gt;/loginError.jsp&lt;/form-error-page&gt;
  &lt;/form-login-config&gt;
  </code></pre>
  
  <p></p>
  
  <p>Here is my realm snippet from  server.xml file:</p>
  
  <pre><code>  &lt;Realm className="org.apache.catalina.realm.LockOutRealm"&gt;
  
      &lt;Realm className="org.apache.catalina.realm.UserDatabaseRealm"
        resourceName="UserDatabase"/&gt;
  
    &lt;/Realm&gt;
  
  
    &lt;Realm className="org.apache.catalina.realm.JDBCRealm" 
  driverName="oracle.jdbc.OracleDriver"
  connectionURL="jdbc:oracle:thin:@localhost:1521:XE"
     userTable="users"userNameCol="username" 
  userCredCol="wpassword"userRoleTable="roles"roleNameCol="rolename"/&gt;
  </code></pre>
  
  <p>Does my connectionURL look right?  What else might be wrong?  Right now when I try to login it never accepts my password.  I always get my login error page (not a full app crash ).</p>
  
  <p>Latest realm version:</p>
  
  <pre><code>&lt;Realm className="org.apache.catalina.realm.JDBCRealm"
         driverName="oracle.jdbc.OracleDriver"
         connectionURL="jdbc:oracle:thin:@localhost:1521:XE"
         connectionName="uname"
         connectionPassword="pword_33"
         userTable="USERS"
         userNameCol="USERNAME"
         userCredCol="WPASSWORD"
         userRoleTable="ROLES"
         roleNameCol="ROLENAME" /&gt;
  </code></pre>