Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java Open Source > Apache Tomcat
|
Apache Tomcat General discussion of the Apache Tomcat servlet container. For discussions specific to the Professional Apache Tomcat book, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Apache Tomcat section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 1st, 2006, 07:08 PM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 146
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to aadz5
Default problem with JDBC realm

Hi Guys,

I am having problems with creating a JDBC realm in my server.xml. This is how I have configured the server.xml so far:

    <Realm className="org.apache.catalina.realm.JDBCRealm"
        debug="99"
                 driverName="com.mysql.jdbc.Driver"
              connectionURL="jdbc:mysql://localhost/singlesignon"
             connectionName="root"
        connectionPassword="password"
                  userTable="users"
        userNameCol="Username"
        userCredCol="Password"
              userRoleTable="userroles"
        roleNameCol="Role" />
</Context>

Under the context is the following:

<!--
<Valve className="org.apache.catalina.valves.RequestDumpe rValve"/>
-->



<!-- This Realm uses the UserDatabase configured in the global JNDI
     resources under the key "UserDatabase". Any edits
     that are performed against this UserDatabase are immediately
     available for use by the Realm. -->


<Realm className="org.apache.catalina.realm.UserDatabaseR ealm"
resourceName="UserDatabase"/>



<!-- Comment out the old realm but leave here for now in case we
     need to go back quickly -->

****COULD SOME ONE PLEASE EXPLAIN WHAT THE COMMENT ABOVE MEANS??****

<!--
<Realm className="org.apache.catalina.realm.MemoryRealm" />
-->

<!-- Replace the above Realm with one of the following to get a Realm
     stored in a database and accessed via JDBC -->

Thanks Guys

Adz - Learning The J2EE Ways.
__________________
Adz - Learning The J2EE Ways.
 
Old September 2nd, 2009, 06:32 PM
Registered User
 
Join Date: Sep 2009
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by aadz5
<!-- Comment out the old realm but leave here for now in case we
need to go back quickly -->

****COULD SOME ONE PLEASE EXPLAIN WHAT THE COMMENT ABOVE MEANS??****

<!--
<Realm className="org.apache.catalina.realm.MemoryRealm" />
-->
What that means is the Realm line that contains the MemoryRealm entry has been commented so it doesn't interfere with the Realm line above that is using the UserDatabase. Surrounding the line with "<!-- " and " -->" comments it so it is not read as part of the configuration. But leaving the line there in case you want to revert to the earlier behavior/configuration quickly. (Delete the "<!-- " line and the " -->" line from around the "<Realm className="org.apache.catalina.realm.MemoryRealm" />" line and put the same lines around the "<Realm className="org.apache.catalina.realm.UserDatabaseR ealm" ResourceName="UserDatabase"/>" line and restart the Tomcat server.)

Now, a couple things that I notice as differences between what you have posted above and what I have in our servers that is working are:

1.) In our configuration, we have the port and database names in the connectionURL (e.g. "jdbc:mysql://127.0.0.1:3306/test" where 'test' = the name of the database. So, your database is called 'singlesignon'?)

2.) I notice that you are using:
Code:
        userTable="users"
        userNameCol="Username"
        userCredCol="Password"
Are the columns in your database for username and password using capitals at the beginning of their names? Case sensitivity can be an issue with these.

HTH.





Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with JDBC Poman Prashant Java Databases 2 June 20th, 2007 02:06 AM
problem with jdbc protozoa JSP Basics 3 December 30th, 2006 06:08 AM
Error ORA-27101: shared memory realm does not exis rajan_sood Oracle 0 October 17th, 2005 12:53 PM
Cannot load JDBC driver class with com.mysql.jdbc. dzis Apache Tomcat 0 January 29th, 2004 11:57 AM
Cannot load JDBC driver class with com.mysql.jdbc. dzis MySQL 0 January 29th, 2004 11:31 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.