tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: Tomcat JBDCRealm with Oracle DB
Date Mon, 16 Dec 2013 13:22:59 GMT
Арсений Зинченко wrote:
> Hi.
> 
> I configured two JDBCRealm's - for MySQL and Oracle databases.
> 
> Both DB have same tables with same content:
> 
> mysql> show tables;
> +----------------------+
> | Tables_in_tmc_access |
> +----------------------+
> | user_roles           |
> | users                |
> +----------------------+
> 
> mysql> desc user_roles;
> +-----------+--------------+------+-----+---------+-------+
> | Field     | Type         | Null | Key | Default | Extra |
> +-----------+--------------+------+-----+---------+-------+
> | user_name | varchar(100) | NO   | PRI | NULL    |       |
> | role_name | varchar(100) | NO   | PRI | NULL    |       |
> +-----------+--------------+------+-----+---------+-------+
> 2 rows in set (0.00 sec)
> 
> mysql> desc users;
> +-----------+--------------+------+-----+---------+-------+
> | Field     | Type         | Null | Key | Default | Extra |
> +-----------+--------------+------+-----+---------+-------+
> | user_name | varchar(100) | NO   | PRI | NULL    |       |
> | user_pass | varchar(100) | NO   |     | NULL    |       |
> +-----------+--------------+------+-----+---------+-------+
> 2 rows in set (0.00 sec)
> 
> mysql> select * from users,user_roles;
> +------------+-----------+------------+------------+
> | user_name  | user_pass | user_name  | role_name  |
> +------------+-----------+------------+------------+
> | indexadmin | password  | indexadmin | indexadmin |
> +------------+-----------+------------+------------+
> 1 row in set (0.00 sec)
> 
> Oracle:
> 
> SQL> SELECT table_name FROM user_tables;
> 
> TABLE_NAME
> ------------------------------
> TMC_USERS_SET
> USER_ROLES_SET
> 
> SQL> desc USER_ROLES_SET;
>  Name                                      Null?    Type
>  ----------------------------------------- --------
> ----------------------------
>  USER_NAME                                 NOT NULL VARCHAR2(100)
>  ROLE_NAME                                 NOT NULL VARCHAR2(100)
> 
> SQL> desc TMC_USERS_SET;
>  Name                                      Null?    Type
>  ----------------------------------------- --------
> ----------------------------
>  USER_NAME                                 NOT NULL VARCHAR2(100)
>  USER_PASS                                 NOT NULL VARCHAR2(100)
> 
> 
> SQL> select * from TMC_USERS_SET,USER_ROLES_SET;
> 
> USER_NAME
> --------------------------------------------------------------------------------
> USER_PASS
> --------------------------------------------------------------------------------
> USER_NAME
> --------------------------------------------------------------------------------
> ROLE_NAME
> --------------------------------------------------------------------------------
> indexadmin
> password
> indexadmin
> indexadmin
> 
> server.xml config:
> 
> <!--      <Realm  className="org.apache.catalina.realm.JDBCRealm"
>              driverName="org.gjt.mm.mysql.Driver"
>           connectionURL="jdbc:mysql://10.***.***.239/tmc_access"
>          connectionName="tmc_access" connectionPassword="password"
>               userTable="users" userNameCol="user_name"
> userCredCol="user_pass"
>           userRoleTable="user_roles" roleNameCol="role_name" /> -->
> 
> 
> 
>       <Realm  className="org.apache.catalina.realm.JDBCRealm"
>              driverName="oracle.jdbc.driver.OracleDriver"
>           connectionURL="jdbc:oracle:thin:@oraclehost:1521:correctscheme"
>          connectionName="tmc" connectionPassword="tmc"
>               userTable="tmc_users_set" userNameCol="user_name"
> userCredCol="user_pass"
>           userRoleTable="user_roles_set" roleNameCol="role_name" />
> 
> web.xml:
> 
> 
> <security-constraint>
> 
>   <web-resource-collection>
>     <web-resource-name>Restricted Area</web-resource-name>
>     <url-pattern>/index.jsp</url-pattern>
>   </web-resource-collection>
> 
>   <auth-constraint>
>     <role-name>indexadmin</role-name>
>   </auth-constraint>
> 
> </security-constraint>
> 
> <login-config>
>   <auth-method>BASIC</auth-method>
> </login-config>
> 
> <security-role>
>   <role-name>indexadmin</role-name>
> </security-role>
> 
> 
> So, when I switch config to Oracle Realm - it is not working (just return
> again login-window)... With MySQL - working perfect.
> 
> What I'm doing wrong?
> 

Not looking at the Tomcat logfiles ?


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message