Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

Can't get DB Pooling to Work

Karl Coleman

2005-02-18

Replies:

I've tried word for word what the documentation says to do to use DBCP with Tomcat but I can't get it to work. Here's the exception I am getting:

javax.servlet.ServletException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver"
 org.apache.jasper.runtime.PageContextImpl.doHandlePageException (PageContextImpl.java:846)
 org.apache.jasper.runtime.PageContextImpl.handlePageException (PageContextImpl.java:779)
 org.apache.jsp.MyJsp_jsp._jspService(org.apache.jsp.MyJsp_jsp:81)
 org.apache.jasper.runtime.HttpJspBase.service (HttpJspBase.java:99)
 javax.servlet.http.HttpServlet.service (HttpServlet.java:802)
 org.apache.jasper.servlet.JspServletWrapper.service (JspServletWrapper.java:325)
 org.apache.jasper.servlet.JspServlet.serviceJspFile (JspServlet.java:295)
 org.apache.jasper.servlet.JspServlet.service (JspServlet.java:245)
 javax.servlet.http.HttpServlet.service (HttpServlet.java:802)
root cause
javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver"
 org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection (QueryTagSupport.java:276)
 org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag (QueryTagSupport.java:159)
 org.apache.jsp.MyJsp_jsp._jspx_meth_sql_query_0(org.apache.jsp.MyJsp_jsp:100)
 org.apache.jsp.MyJsp_jsp._jspService(org.apache.jsp.MyJsp_jsp:58)
 org.apache.jasper.runtime.HttpJspBase.service (HttpJspBase.java:99)
 javax.servlet.http.HttpServlet.service (HttpServlet.java:802)
 org.apache.jasper.servlet.JspServletWrapper.service (JspServletWrapper.java:325)
 org.apache.jasper.servlet.JspServlet.serviceJspFile (JspServlet.java:295)
 org.apache.jasper.servlet.JspServlet.service (JspServlet.java:245)
 javax.servlet.http.HttpServlet.service (HttpServlet.java:802)
I believe my context isn't working or it's not finding it. I'm using Tomcat 5.5.7 and mySQL. I have tried putting it in server.xml, in context.xml in the MANIFEST-INF folder of the webapp, and in conf/Catalina/localhost/context.xml. The context I'm using is exactly like it is in the docs except the user and password and resource name and it uses mySQL.
<Context path="/dotdraft" docBase="dotdraft"
    debug="5" reloadable="true" crossContext="true">

<Resource name="jdbc/dotdraft" auth="Container" type="javax.sql.DataSource"
         maxActive="100" maxIdle="30" maxWait="10000"
         username="xxx" password="xxx" driverClassName="com.mysql.jdbc.Driver"
         url="jdbc:mysql://localhost:3306/test"/>

</Context>

Thanks,
Karl
©2008 junlu.com - Jax Systems, LLC, U.S.A.