tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karen E. Lee" <karen...@nersp.nerdc.ufl.edu>
Subject DB connection tag question
Date Thu, 16 Aug 2001 18:26:46 GMT
I am using DBTags in an app I'm working on... very simple, just one jsp page.  I am confused
about how to use a datasource to get the connection. In the API it says 

"The connection tag also accepts a reference to a Servlet attribute containing a javax.sql.DataSource
object. (The attribute is found via the findAttribute() method of PageContext.):"

I have used scriptlets to create a DataSource object from a JNDI named connection pool:
      
      <% Hashtable params = new Hashtable(); %>
      <% params.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "com.ibm.ejs.ns.jndi.CNInitialContextFactory");
%>
      <% Context ctx = new javax.naming.InitialContext(params); %>
      <% javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup("jdbc/mydatabase");
%>

How do I now use this DataSource in my connection tag?
Thanks.

 
-- 
Karen Lee
Open Systems Group
Northeast Regional Data Center
University of Florida
karenlee@nersp.nerdc.ufl.edu


Mime
View raw message