tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan_Pie...@seagram.com (Jonathan Pierce)
Subject Re:RE: JDBC Realm Questions Tomcat 3.2.2
Date Thu, 05 Jul 2001 14:14:45 GMT

>>The real question is are you just wanting jdbc datasources
>>or are you wanting a JDBC user authentication modality?  Because
>>that's what JDBCRealm is for, not for general JDBC connections.
>>Once, again I've got to say I think you are misunderstanding Realms.
>>You do not need to directly access JDBC Realms.  What exactly are
>>you trying to do.  I think what you're really looking for is a
>>DB Connection pool(s).

Okay, I was confused. I now realize that JDBC Realms are intended for
authenticating web application users, not allocating JDBC connections.

Now, JDBC 2.0 also has the concept of DataSources. In my environment, I need to
configure the datasources outside of the application war file since the database
passwords need to be changed at deployment time by the site administrator.

How do I describe a datasource resource in the Tomcat conf files, and access it
by name. I imaging I will need to be able to do get an initial context, and do a
jndi lookup to get the DataSource. I would then be able to use the datasource to
allocate a connection with getConnection without needing to know the userid or
password.

Can this be done in Tomcat 3.2.2? What about 3.3 or 4.0b5? 
If so, How? Please provide an example of what needs to be done so that I can
call:

String theDataSourceName = "MyDataSource";
Context theContext = new InitialContext ();
DataSource theDataSource = (DataSource) theContext.lookup (theDataSourceName);

Jonathan

Mime
View raw message