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 4332972
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T10:19:47+00:00 2026-05-21T10:19:47+00:00

I want to create a JDBC Realm for my web app. Since my users

  • 0

I want to create a JDBC Realm for my web app. Since my users are very different from each other i need to have just one table, with the usernames and passwords for the realm, i decided to create a new table in my database called ROLE(oneToOne relationship with the other users table).

This is how my users domain model looks like:
enter image description here

I am following this tutorial http://blog.gamatam.com/2009/11/jdbc-realm-setup-with-glassfish-v3.html but i am stuck, i dont know how to continue.

I will post the configuration i made at the glassfish server and also my file sun.resources.xml so you can correct me if i am making any mistake:
enter image description here

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0  Resource Definitions //EN" "http://www.sun.com/software/appserver/dtds/sun-resources_1_3.dtd">
 <resources>
 <jdbc-resource enabled="true" jndi-name="jdbc/myDatasource" object-type="user" pool- name="Derby_grupovina_grupovinauserPool"/>
 <jdbc-connection-pool allow-non-component-callers="false" associate-with-thread="false" connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10" connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" connection-validation-method="auto-commit" datasource-classname="org.apache.derby.jdbc.ClientDataSource" fail-all-connections="false" idle-timeout-in-seconds="300" is-connection-validation-required="false" is-isolation-level-guaranteed="true" lazy-connection-association="false" lazy-connection-enlistment="false" match-connections="false" max-connection-usage-count="0" max-pool-size="32" max-wait-time-in-millis="60000" name="Derby_grupovina_grupovinauserPool" non-transactional-connections="false" pool-resize-quantity="2" res-type="javax.sql.DataSource" statement-timeout-in-seconds="-1" steady-pool-size="8" validate-atmost-once-period-in-seconds="0" wrap-jdbc-objects="false">
<property name="serverName" value="localhost"/>
    <property name="PortNumber" value="1527"/>
    <property name="DatabaseName" value="grupovina"/>
    <property name="User" value="grupovinauser"/>
    <property name="Password" value="grupovina"/>
    <property name="URL" value="jdbc:derby://localhost:1527/grupovina;create=true"/>
    <property name="driverClass" value="org.apache.derby.jdbc.ClientDriver"/>
   </jdbc-connection-pool>
  </resources>

In the above comfiguration i have a few doubts, I dont really understand what should i ad at Group table and Group name Column.

The tutorial im following says that i should add security roles at the file sun-web.xml, and i wanted to do it but i dont know what to put in the configuratio. This is just what i added to that file but i think it is not correct. Where in that file should i add the role mapping and how should i configure it?

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Servlet 2.5//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd">
<sun-web-app error-url="">
<context-root>/GroupBuySystem</context-root>
<class-loader delegate="true"/>
<jsp-config>
<property name="keepgenerated" value="true">
  <description>Keep a copy of the generated servlet class java code.</description>
</property>
</jsp-config>    
<security-role-mapping>
<role-name> </role-name>
<group-name> </group-name>
</security-role-mapping>
</sun-web-app>

The guy of the tutorial said he had not need for a web.xml, but i do need that file. What should i add my web.xml?

This is my first jdbc realm, i am very confused 🙂

  • 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-21T10:19:48+00:00Added an answer on May 21, 2026 at 10:19 am

    I assume (from your previous question) that you don’t have a group table. In fact you don’t necessarily need one. JDBCRealm works with only a user table containing a group column as well.

    In your Glassfish admin console change the following:

    Group Table: Role

    Group Name Column: userType

    Since you used different typings (letter cases) for the word “role”, make sure that the configuration values for your realm are exactly the same as in the table.

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

Sidebar

Related Questions

I'm using persistence API and want to load jdbc URL from web.xml. URL should
i want create image animation , i have 50 images with png format now
I want to create a client side mail creator web page. I know the
I want to create a simple http proxy server that does some very basic
So I want to create a JDBC connection to MySQL server that is installed
I want to handle a MySQL database using JDBC from inside an operation of
I want to create a test suit for my java web application. Its a
I want to create a combo box in jsp that contains values fetched from
I have successfully created Web Services from MySQL Database using Netbeans tutorial . However,
I want create a drop shadow around the canvas component in flex. Technically speaking

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.