Jumping in late on this one too. Maybe it's just a typo, but JSTL doesn't have a <sql:dataSource> tag. It does have a <sql:setDataSource> tag. If your web.xml includes something like:
<resource-ref> <res-ref-name>jdbc/EmployeeAppDb</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> <res-sharing-scope>Shareable</res-sharing-scope> </resource-ref> Then there are a couple of different ways to use the same datasource in JSTL: 1). Add the following to web.xml to define the default datasource for JSTL: <context-param> <param-name>javax.servlet.jsp.jstl.sql.dataSource</param-name> <param-value>jdbc/EmployeeAppDb</param-value> </context-param> 2). Use the "dataSource" attribute with <sql:query>, <sql:update>, or <sql:transaction>: <sql:query dataSource="jdbc/EmployeeAppDb" .../> Quoting Roy Benjamin <[EMAIL PROTECTED]>: > Thanks, > > I'll do the reading. What got me thinking was that the > tag requires four parts of information, with all four > no reference to a JNDI source is needed. One would > have expected something like: > > <sql:dataSource resource="jdbc/EmployeeAppDb"/> > > and this would refer to: > > <Resource name="jdbc/EmployeeAppDb" auth="SERVLET" > type="javax.sql.DataSource"/> > <ResourceParams name="jdbc/EmployeeAppDb"> > ...... > </ResourceParams> > > for tha app's context in server.xml. > > Then it would be very clear that the jstl dataSource was > using the JNDI (managed) connection pool. > > Roy > > On Fri, 2004-04-02 at 16:48, Bill Siggelkow wrote: > > I was under the impression that if you used the "sql:dataSource" tag that > > you were essentially using whatever connection mgmt was behind the data > > source. Therefore, you would need to consult how you configured the Data > > Source in Tomcat to get connection pooling. > > > > Reading further maybe you have already done this? Anyway, I here is the > URL > > for setting up Tomcat data sources. > > > > > http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-how > > to.html > > > > Also, you may want to check the JSTL spec -- it has a fair amount of info > on > > accessing data sources. > > > > Bill Siggelkow > > [EMAIL PROTECTED] > > > > > > -----Original Message----- > > From: Roy Benjamin [mailto:[EMAIL PROTECTED] > > Sent: Friday, April 02, 2004 5:12 PM > > To: Tag Libraries Users List > > Subject: Tomcat JNDI JDBC connection/JSTL DataSource > > > > > > I think I'm having some trouble with JDBC access via JSTL. I'm uncertain, > > but performance seems very sporadic and may relate to connection overhead > > and resource exhaustion. > > > > Now, I only see one form for the sql:dataSource tag and it seems not to > > allow for any connection management or tuning. > > > > What I am wondering is if there is a resouce usage efficiency issue with > > jstl sql access. > > > > Prior to using jstl I usd the JNDI lookup for a JDBC resource that was > > actually pooled and managed by Tomcat for that context. (I think this is > > more or less correct notion.) > > > > Anyway, supposing I set up the same JNDI resource for an app that uses > > jstl/sql ? Can I create a jstl/sql dataSource thatreally uses the pooled > > resources managed by Tomcat? > > > > Are the reasons why this is a good idea? Is it possible? > > > > Thanks > > > > Roy -- Kris Schneider <mailto:[EMAIL PROTECTED]> D.O.Tech <http://www.dotech.com/> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
