tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roland" <rol...@netquant.com.br>
Subject PLEASE HELP ME WITH JDBC REALMS(LONG AND DETAILED POST)
Date Tue, 28 Aug 2001 22:31:51 GMT
Ok, now I will give all details of my problem, you asked for it! :)
First of all I`m using Tomcat 4.0-b5(beta 5)

Now for the information available on the WEB:
First of all its confusing and contradictory. There doesn`t seem to be
information on using JDBC realms for TOMCAT 4.X, so the information I found
is for Tomcat 3.2.X(look at http://tomcat.mslinn.com/)
Go to that page and to the link named "JDBC realms" in the TOMCAT 3.2.X
docs.

He will tell you to create the tables in a MySql database. Thats fine, since
we run MySql here, so there was no problem setting up the tables.
The next step is setting up the server.xml file in the  tomcat_home/conf
directory.
Here the contradictions start.
In the Tomcat 3.2.X docs in http://tomcat.mslinn.com/ they have the
following format:

    <RequestInterceptor className="org.apache.tomcat.request.JDBCRealm"
debug="99"
     driverName="org.gjt.mm.mysql.Driver"

connectionURL="jdbc:mysql://localhost/authority?user=test;password=test"
     userTable="users" userNameCol="user_name" userCredCol="user_pass"
     userRoleTable="user_roles" roleNameCol="role_name" />

Now if you go to the other tutorial about JDBC realms that I have read at
http://www.onjava.com/pub/a/onjava/2001/07/24/tomcat.html
they use an <realm> element instead of the <RequestInterceptor> element:

<realm classname="org.apache.catalina.realm.JDBCRealm" debug="99"
    drivername="org.gjt.mm.mysql.Driver"

connectionurl="jdbc:mysql://localhost/tomcatusers?user=test;password=test"
    usertable="users" usernamecol="user_name" usercredcol="user_pass"
    userroletable="user_roles" rolenamecol="role_name"/>

So what kind of Element should I use?

The next question is that unlike the Memory Realm, there seems to be no need
to configure the web.xml file. This looks like nonsense for me. Both
tutorials above dont say anything about the web.xml file. But in the onjava
tutorial, when talking about the memory realm he says that you must have the
following stuff in your web.xml file:

<security-constraint>
    <web-resource-collection>
        <web-resource-name>OnJava Application</web-resource-name>
        <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
        <role-name>onjavauser</role-name>
    </auth-constraint>
</security-constraint>

<login-config>
    <auth-method>BASIC</auth-method>
    <realm-name>OnJava Application</realm-name>
</login-config>


So I think that I also need this kind of information in my web.xml file,
even if I`m using JDBC realms instead of memory realms, or do I see
something wrong here?
That makes me wonder how the guys using JDBC realms arent experiencing any
problems and didnt seem to notice the contradictions in the above
documenations.
Btw, if you use memory realms you also have to configure the
"tomcat-users.xml" file in the TOMCAT_HOME/conf directory. Is there a
problem if you let that file floating around when using JDBC realms?

About the server.xml file:
In the servlet specification 2.3 they describe the structure of the web.xml
file. But I cant find the description of the server.xml file. So where is
that? That would be important to clarify what Element to use(<realm> or
<RequestInterceptor>). Btw I have renamed the element name but it didn't
work either. he

Thanks for any help and documentations...

Roland


Mime
View raw message