aspose file tools*
The moose likes Tomcat and the fly likes Using JDBCRealm in JSP application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Using JDBCRealm in JSP application" Watch "Using JDBCRealm in JSP application" New topic

Using JDBCRealm in JSP application

Rudy Rusli
Ranch Hand

Joined: Jun 01, 2006
Posts: 114
I'm trying to use JDBC-Realm to save username and password information for my JSP application.
But it seems that the username and login doesn't work when I try to login.

I built two tables in MySQL database called 'user' and 'roles'.
There is only one entry in each table:
user (column names: username, password) -> 'myname', 'mypassword'
roles (column names: username, roles) -> 'myname', 'myrole'

Then I put these lines below in my server.xml.
<Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
connectionName="myDbUsername" connectionPassword="myDbPassword"
userTable="user" userNameCol="username" userCredCol="password"
userRoleTable="roles" roleNameCol="roles" />

I try to login using 'myname' and 'mypassword' but it doesn't work.

Can somebody please advice?

ps: I'm using Tomcat 5.5
I agree. Here's the link:
subject: Using JDBCRealm in JSP application
Similar Threads
Windows Authentication Using Tomcat 5.0
Is it Tomcat's Bug or My Mistake
Using JDBCRealm in JSP application
Apache authorization doesn't work for jsp's
Having problem when using web.xml to provide login system to user.