Mysql logging with Tomcat (JDBCRealm)
Hi there,
I'm pretty new to Tomcat and have to set up a mysql JDBCRealm to authenticate tomcat users.
I altered the server.xml file to use the JDBCRealm and login works fine - but the roles are not loaded and I don't know why? I tried to register the mysql logger, but this just doesn't work:
here's my server.xml:
##############
<Realm
debug="99"
className="org.apache.catalina.realm.JDBCRealm"
driverName="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://localhost/authority"
connectionName="root"
connectionPassword="xxxxxx"
userTable="users"
userNameCol="username"
userCredCol="password"
userRoleTable="user_roles"
roleNameCol1="rolename">
<Logger
className="com.mysql.jdbc.log.Log"
profileSQL="true"
verbosity="4"/>
</Realm>
##############
and this is my mysql authority table:
##############
users:
-------------------
CREATE TABLE `users` (
`username` varchar(12) NOT NULL default '',
`password` varchar(12) NOT NULL default '',
PRIMARY KEY (`username`)
) TYPE=MyISAM;
--
-- Daten für Tabelle `users`
--
INSERT INTO `users` VALUES ('admin', 'tomcat');
INSERT INTO `users` VALUES ('tomcat', 'tomcat');
INSERT INTO `users` VALUES ('role1', 'role1');
INSERT INTO `users` VALUES ('testuser', 'test');
INSERT INTO `users` VALUES ('root', 'tomcat');
-------------------
user_roles:
-------------------
CREATE TABLE `user_roles` (
`rolename` varchar(12) NOT NULL default '',
`username` varchar(12) NOT NULL default '',
PRIMARY KEY (`rolename`,`username`)
) TYPE=MyISAM;
--
-- Daten für Tabelle `user_roles`
--
INSERT INTO `user_roles` VALUES ('admin', 'admin');
INSERT INTO `user_roles` VALUES ('manager', 'admin');
INSERT INTO `user_roles` VALUES ('manager', 'root');
INSERT INTO `user_roles` VALUES ('manager', 'tomcat');
INSERT INTO `user_roles` VALUES ('tomcat', 'tomcat');
Thank you for your time and your helping comments!
Sascha
Subject
Written By
Posted
Mysql logging with Tomcat (JDBCRealm)
March 08, 2005 04:26AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.