You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Justin Wesbrooks <we...@amerch.com> on 2003/11/19 23:58:17 UTC
JDBC Realm
I have a JDBCRealm set up in Tomcat 4.1.29. The realm config is as
follows..
<Realm className="org.apache.catalina.realm.JDBCRealm"
debug="99" driverName="org.gjt.mm.mysql.Driver"
connectionURL="jdbc:mysql://localhost:3306/cofc?user=root;password=root"
userTable="users"
userNameCol="'USERNAME'"
userCredCol="'USERPASS'"
userRoleTable="user_roles"
roleNameCol="'UR_ROLENAME'"/>
I have a mysql database set up that matches the above.
I have a web app with the following web.xml..
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Justin Web App</display-name>
<description>Test justin web app</description>
<security-constraint>
<display-name>TEST Security Constraint</display-name>
<web-resource-collection>
<web-resource-name>Protected Area</web-resource-name>
<url-pattern>*.jsp</url-pattern>
<url-pattern>*.do</url-pattern>
<url-pattern>*.html</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>member</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>testrealm</realm-name>
</login-config>
<security-role>
<description>The role that is required to log in to the Administration
Application</description>
<role-name>member</role-name>
</security-role>
</web-app>
All that is in my webapp is an index.html and this web.xml. I'm trying to
authenticate / authorize against the database but can't get it to work.
When I go to http://localhost:8080/justin I get a username / password
prompt as I should but when I enter my username and password, it fails.
The troubling thing is that there are no errors in any of the log files.
I've checked over and over again that the user is in the table and that
table / field names are all correct. I feel that my configuration is
correct because if I kill the mysql server, Tomcat fails to start. I've
searched Google and the archives and can't seem to find anything specific
to this problem.
Can someone point me to some literature / faq, etc. that might help
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: JDBC Realm
Posted by Tim Funk <fu...@joedog.org>.
Get rid of the single quotes.
userNameCol="USERNAME"
-Tim
Justin Wesbrooks wrote:
>
>
>
> I have a JDBCRealm set up in Tomcat 4.1.29. The realm config is as
> follows..
>
> <Realm className="org.apache.catalina.realm.JDBCRealm"
> debug="99" driverName="org.gjt.mm.mysql.Driver"
> connectionURL="jdbc:mysql://localhost:3306/cofc?user=root;password=root"
> userTable="users"
> userNameCol="'USERNAME'"
> userCredCol="'USERPASS'"
> userRoleTable="user_roles"
> roleNameCol="'UR_ROLENAME'"/>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org