Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4070694
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:39:37+00:00 2026-05-20T16:39:37+00:00

I’m understand that <security-role><role-name>Admin</role-name></security-role> is for container map it with tomcat-users.xml (realm) but I

  • 0

I’m understand that
<security-role><role-name>Admin</role-name></security-role>
is for container map it with tomcat-users.xml (realm)

but I confuse about if I didn’t use realm but I use database how container know which field in my database is for role-name or it have naming convention in database field name like “role_name” and container will know it

Thank you for every advices

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T16:39:38+00:00Added an answer on May 20, 2026 at 4:39 pm

    Just use a database realm and configure the table and column names in a <Realm> element in server configuration file. For Tomcat, this is described in the Realm HOWTO. Here’s an extract of relevance, from the JDBCRealm chapter:

    Quick Start

    To set up Tomcat to use JDBCRealm, you will need to follow these steps:

    1. If you have not yet done so, create tables and columns in your
      database that conform to the
      requirements described above.
    2. Configure a database username and password for use by Tomcat, that
      has at least read only access to the
      tables described above. (Tomcat will
      never attempt to write to these
      tables.)
    3. Place a copy of the JDBC driver you will be using inside the
      $CATALINA_HOME/lib directory. Note
      that only JAR files are recognized!
    4. Set up a <Realm> element, as described below, in your
      $CATALINA_BASE/conf/server.xml file.
    5. Restart Tomcat 6 if it is already running.

    Realm Element Attributes

    To configure JDBCRealm, you will
    create a <Realm> element and nest it
    in your $CATALINA_BASE/conf/server.xml
    file, as described above. The
    attributes for the JDBCRealm are
    defined in the Realm configuration
    documentation.

    Example

    An example SQL script to create the
    needed tables might look something
    like this (adapt the syntax as
    required for your particular
    database):

    create table users (
      user_name         varchar(15) not null primary key,  
      user_pass         varchar(15) not null
    );
    
    create table user_roles (
      user_name         varchar(15) not null,
      role_name         varchar(15) not null,
      primary key(user_name, role_name)
    );
    

    Example Realm elements are included
    (commented out) in the default
    $CATALINA_BASE/conf/server.xml file.
    Here’s an example for using a MySQL
    database called “authority”,
    configured with the tables described
    above, and accessed with username
    “dbuser” and password “dbpass”:

    <Realm className="org.apache.catalina.realm.JDBCRealm"
          driverName="org.gjt.mm.mysql.Driver"  
       connectionURL="jdbc:mysql://localhost/authority?user=dbuser&amp;password=dbpass"
           userTable="users" userNameCol="user_name" userCredCol="user_pass"   
       userRoleTable="user_roles" roleNameCol="role_name"/>
    

    Pretty clear, isn’t it? If you already have a JDBC datasource configured in Tomcat (for connection pooling and on), then you can also use DataSourceRealm instead.

    The tomcat-users.xml which you’re talking about is by the way called UserDatabaseRealm.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
In my XML file chapters tag has more chapter tag.i need to display chapters

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.