[EMAIL PROTECTED] wrote:
> Hi all!
> 
> I have got a question regarding setup of a JBDCRealm. I read the HOW-TO
> on Tomcat homepage, and I am wondering about the database structure.
> I have an existing application, and the database it uses has got a table
> 'users'
> with the follwing columns: login, password, roleid,... where the roleid is a
> foreign key to the table 'roles' which has columns 'id' and 'rolename'.
> It is sufficient for me because every user can only have one role. Is there
> a way to use this database structure with JDBCRealm? Or do I have to
> add more tables as described in the HOW-TO? My database structure
> already contains all information, so it would be overhead to produce an
> extra table, I think. I tried the following:
> 
> <Realm className="org.apache.catalina.realm.JDBCRealm"
>       debug="99" driverName="org.postgresql.Driver"
>       connectionURL="jdbc:postgresql://localhost:5432/
>               testwebapp?user=login&amp;password=pwd"
>       userTable="users" userNameCol="login"
>       userCredCol="password" userRoleTable="users"
>       roleNameCol="roleid" />
> 
> but I got problems on roleNameCol="roleid". How can I get the rolename
> from table roles?
> 
> Perhaps I missed something, and someone has an idea.

Does you database support views? The JDBCRealm works just as well with
views as well as tables. Just create views with the structure Tomcat
expects.

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to