Thanks for the response.  When I describe the user table, I get the
following output...

Doesn't this indicate that my orinigal configuration without the single
quotes should be correct?


mysql> describe users;
+-----------+---------------+------+-----+---------+-------+
| Field     | Type          | Null | Key | Default | Extra |
+-----------+---------------+------+-----+---------+-------+
| USERNAME  | varchar(16)   |      | PRI |         |       |
| PASSWORD  | varchar(16)   |      |     |         |       |
| EMAIL     | varchar(100)  | YES  |     |         |       |
| CREATE_DT | timestamp(14) | YES  |     | NULL    |       |
+-----------+---------------+------+-----+---------+-------+
4 rows in set (0.01 sec)



                                                                           
             Jon Wingfield                                                 
             <[EMAIL PROTECTED]                                             
             odo.com>                                                   To 
                                       Tomcat Users List                   
             11/20/2003 05:01          <[EMAIL PROTECTED]>    
             AM                                                         cc 
                                                                           
                                                                   Subject 
             Please respond to         Re: JDBC Realm                      
               "Tomcat Users                                               
                   List"                                                   
             <[EMAIL PROTECTED]                                             
              rta.apache.org>                                              
                                                                           
                                                                           




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]




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

Reply via email to