aspose file tools*
The moose likes Tomcat and the fly likes JDBCRealm - different configuration for different deployed webapps Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "JDBCRealm - different configuration for different deployed webapps" Watch "JDBCRealm - different configuration for different deployed webapps" New topic
Author

JDBCRealm - different configuration for different deployed webapps

Adam Kronicki
Ranch Hand

Joined: Sep 01, 2009
Posts: 68
Hello,

I have been using Tomcat's JDBCRealm authentication for my webapps. However, now I need to deploy a new webapp on the same tomcat. This new webapp also needs JDBCRealm authentication but the database is different then the one that is alredy configured. Is it possible to use different databases for different web applications deployed on tomcat? I cannot find any solution here. Can anyone help?
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
Yes, that's possible: http://tomcat.apache.org/tomcat-7.0-doc/realm-howto.html#Configuring_a_Realm
Adam Kronicki
Ranch Hand

Joined: Sep 01, 2009
Posts: 68
Thanks, that was quick! As far as I understand I need to cut out the realm tag from tomcat's conf/ server.xml file, and place it in the context tag in each of my app META-INF/context.xml files. Am I right?
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
There, or in the conf/Catalina/localhost directory - wherever it makes more sense to keep the <Context> information.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: JDBCRealm - different configuration for different deployed webapps