Win a copy of Spring Boot in Practice this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

JSTL SQL and MYSQL connection help.

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I'm really baffled right now because I'm trying to get a DB connection using JSTL's SQL ataSource tag and just will not work. the code for the page is..
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<sql:setDataSource var="dataSource"
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql//localhost/church"
user="admin"
password="qwe123"/>
<sql:query var="ids" dataSource="${dataSource}">
SELECT * FROM member
</sql:query>
<c:forEach items="${ids}" var="row">
<c ut value="${row}"/>
</c:forEach>
and it's running on Tomcat 5.0.
the error that I get when I run that page is...
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver"
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800)
org.apache.jsp.test.JDBC_0020Test_jsp._jspService(JDBC_0020Test_jsp.java:79)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

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(Unknown Source)
org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(Unknown Source)
org.apache.jsp.test.JDBC_0020Test_jsp._jspx_meth_sql_query_0(JDBC_0020Test_jsp.java:116)
org.apache.jsp.test.JDBC_0020Test_jsp._jspService(JDBC_0020Test_jsp.java:68)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

the thing is...I have my driver in Tomcat's /common/lib folder and the jar file is ...mysql-connector-java-3.0.11-stable-bin.jar
if anybody could help out...it would be much appreciated.
Thank You
 
Han You
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello? Anybody out there? I could REALLY use some help.
 
reply
    Bookmark Topic Watch Topic
  • New Topic