-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Leo,
On 3/24/2010 11:43 AM, Leo Donahue - PLANDEVX wrote: > No, not sure. That is what I was confused about. > JDBC Realm, vs JNDI DataSourceRealm, vs JDBC DataSource A Realm is something Tomcat uses for authentication. A DataSource is an object which hands out database connections. The use of JDBC vs. JNDI is really just about how the connections are obtained: JDBCRealm manages its own JDBC connection (and is heavily synchronized, as Mark mentions: don't use it). DataSourceRealm uses a DataSource obtained via JNDI and configured via a <Resource> element. There is no JDBCDataSource that I know of. Recommended setup (IMHO): configure everything in META-INF/context.xml and use DataSourceRealm. No need to configure anything in server.xml and no need to configure anything at the OS level (as Mark mentioned, that's ODBC). > Assuming I have the correct tables in the database named "authstore", does > this look right? > > ** in server.xml ** > <Realm className="com.microsoft.sqlserver.jdbc.SQLServerDriver" className should be org.apache.catalina.realm.DataSourceRealm > dataSourceName="jdbc/authority" > userTable="users" userNameCol="user_name" userCredCol="user_pass" > userRoleTable="user_roles" roleNameCol="role_name"/> Ok. > ** in META-INF/context.xml of specific webapp ** > <resource-ref> > <description>DB Connection</description> > <res-ref-name>jdbc/authority</res-ref-name> > <res-type>javax.sql.DataSource</res-type> > <res-auth>Container</res-auth> > </resource-ref> This is actually stuff for web.xml, though it is not required if you have your <Resource> defined in META-INF/context.xml. > ** also in META-INF/context.xml file? ** > <Resource name="jdbc/authority" auth="Container" type="javax.sql.DataSource" > username="javauser" password="javadude" > driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" > url="jdbc:sqlserver://localhost;database=authstore"/> Looks good to me. Make sure your JDBC driver JAR file is in CATALINA_BASE/lib and nowhere else. - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkuqNfkACgkQ9CaO5/Lv0PAgQwCgt7UySAU4hOcZzw4oGFlEqeqM l3EAoJt8ySaQRmKKwVZbS8NytPs8HfqZ =ou3q -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org