mySQL is case-sensitive on column names.
In mysql describe the users and user_roles tables. Use the column names as returned.


eg:

mysql>describe bobbins;
+-------------------+--------------+------+-----+---------+-------+
| Field             | Type         | Null | Key | Default | Extra |
+-------------------+--------------+------+-----+---------+-------+
| bobbins_id        | bigint(20)   |      | PRI | 0       |       |
| description       | varchar(255) |      |     |         |       |
+-------------------+--------------+------+-----+---------+-------+
2 rows in set (0.09 sec)

The single quotes you are using have unanticipated side effects:
The sql generated by the JDBCRealm will be something like
select 'USERPASS' from users where 'USERNAME' = ?;

This will bring back zero rows unless the password is actually the string literal 'USERNAME'. In that case the value returned will be the string literal 'USERPASS' not the data within the password column.

I would guess your columns are defined in lowercase so the realm setup should be:

>><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'"/>

HTH,

Jon



Justin Wesbrooks wrote:
When I get rid of the single quotes, the Mysql JDBC driver throws an SQLException that says something like "column USERNAME not found"

I originally had it without the single quotes. To solve the error I added them just to try it and it worked, so I left them.

Justin




Tim Funk <[EMAIL PROTECTED]> 11/19/2003 05:37 PM
Please respond to
"Tomcat Users List" <[EMAIL PROTECTED]>



To


Tomcat Users List <[EMAIL PROTECTED]>
cc





Subject
Re: JDBC Realm






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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]








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



Reply via email to