You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by "Narayan, Anand" <AN...@e-gatematrix.com> on 2003/06/19 19:47:11 UTC

Data Source problem - JSTL

I am trying to configure a JNDI data source within a JSTL application.
The app server is weblogic 7.0
I have added the following to the web.xml

	<context-param>
	
<param-name>javax.servlet.jsp.jstl.sql.dataSource</param-name>
		<param-value>spsDataSource</param-value>
	</context-param>

In the JSp I am trying to use the sql tags as follows:

<sql:setDataSource var="edmDataSource" dataSource="spsDataSource"/>

<sql:query var="results" dataSource="${edmDataSource}" scope="session"> 
SELECT x.*,y.name FROM sps_carrier_vendor_station x, sps_vendor y WHERE 
x.vendor=y.id ORDER BY x.carrier asc, x.station asc
</sql:query>

This is giving me the sollowing error on the app serve.  It works if I do
not use a data source and configure the
DB connection ( URl, driver, user password etc.) right there in the JSP.
Any ideas??  Thanks.

javax.servlet.jsp.JspException: Unable to get connection, DataSource
invalid: "N
o suitable driver"
        at
org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnect
ion(QueryTagSupport.java:308)
        at
org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag
(QueryTagSupport.java:192)
        at
org.apache.taglibs.standard.tag.el.sql.QueryTag.doStartTag(QueryTag.j
ava:125)
        at
jsp_servlet._carrier_vendor_station.__list_results._jspService(__list
_results.java:171)
        at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
        at
weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
(ServletStubImpl.java:1058)
        at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:401)
        at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:445)
        at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:306)
        at
weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispat
cherImpl.java:542)
        at
weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispat
cherImpl.java:368)
        at
weblogic.servlet.jsp.PageContextImpl.include(PageContextImpl.java:120
)
        at
jsp_servlet._carrier_vendor_station.__list._jspService(__list.java:32
4)
        at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
        at
weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
(ServletStubImpl.java:1058)
        at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:401)
        at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:445)
        at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:306)
        at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:5412)
        at
weblogic.security.service.SecurityServiceManager.runAs(SecurityServic
eManager.java:744)
        at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:3086)
        at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2544)
        at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
        at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: Data Source problem - JSTL

Posted by Michael Duffy <du...@yahoo.com>.
Hi Anand,

Where did you specify the JDBC driver class name,
database URL, username, and password?  You've got to
tell the data source those things, too.  I define them
in the context.xml, using <ResourceParams> under a
<Resource> tag.

I don't know about your WebLogic docs, but here's the
JNDI DataSource HOW-TO for Tomcat:

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html

Maybe that will help.

If you set the default data source using the name
javax.servlet.jsp.jstl.sql.dataSource, you don't have
to use the <sql:setDataSource> tag in your JSPs.  The
default data source will be picked up.

HTH - MOD

--- "Narayan, Anand" <AN...@e-gatematrix.com>
wrote:
> I am trying to configure a JNDI data source within a
> JSTL application.
> The app server is weblogic 7.0
> I have added the following to the web.xml
> 
> 	<context-param>
> 	
>
<param-name>javax.servlet.jsp.jstl.sql.dataSource</param-name>
> 		<param-value>spsDataSource</param-value>
> 	</context-param>
> 
> In the JSp I am trying to use the sql tags as
> follows:
> 
> <sql:setDataSource var="edmDataSource"
> dataSource="spsDataSource"/>
> 
> <sql:query var="results"
> dataSource="${edmDataSource}" scope="session"> 
> SELECT x.*,y.name FROM sps_carrier_vendor_station x,
> sps_vendor y WHERE 
> x.vendor=y.id ORDER BY x.carrier asc, x.station asc
> </sql:query>
> 
> This is giving me the sollowing error on the app
> serve.  It works if I do
> not use a data source and configure the
> DB connection ( URl, driver, user password etc.)
> right there in the JSP.
> Any ideas??  Thanks.
> 
> javax.servlet.jsp.JspException: Unable to get
> connection, DataSource
> invalid: "N
> o suitable driver"
>         at
>
org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnect
> ion(QueryTagSupport.java:308)
>         at
>
org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag
> (QueryTagSupport.java:192)
>         at
>
org.apache.taglibs.standard.tag.el.sql.QueryTag.doStartTag(QueryTag.j
> ava:125)
>         at
>
jsp_servlet._carrier_vendor_station.__list_results._jspService(__list
> _results.java:171)
>         at
>
weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
>         at
>
weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
> (ServletStubImpl.java:1058)
>         at
>
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
> pl.java:401)
>         at
>
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
> pl.java:445)
>         at
>
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
> pl.java:306)
>         at
>
weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispat
> cherImpl.java:542)
>         at
>
weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispat
> cherImpl.java:368)
>         at
>
weblogic.servlet.jsp.PageContextImpl.include(PageContextImpl.java:120
> )
>         at
>
jsp_servlet._carrier_vendor_station.__list._jspService(__list.java:32
> 4)
>         at
>
weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
>         at
>
weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
> (ServletStubImpl.java:1058)
>         at
>
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
> pl.java:401)
>         at
>
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
> pl.java:445)
>         at
>
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
> pl.java:306)
>         at
>
weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
> n.run(WebAppServletContext.java:5412)
>         at
>
weblogic.security.service.SecurityServiceManager.runAs(SecurityServic
> eManager.java:744)
>         at
>
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
> rvletContext.java:3086)
>         at
>
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
> pl.java:2544)
>         at
>
weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
>         at
>
weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> taglibs-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org