GeeCON Prague 2014*
The moose likes JDBC and the fly likes JSTL SQL and MYSQL connection help. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "JSTL SQL and MYSQL connection help." Watch "JSTL SQL and MYSQL connection help." New topic
Author

JSTL SQL and MYSQL connection help.

Han You
Greenhorn

Joined: Oct 26, 2003
Posts: 25
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

Joined: Oct 26, 2003
Posts: 25
Hello? Anybody out there? I could REALLY use some help.
 
GeeCON Prague 2014
 
subject: JSTL SQL and MYSQL connection help.