Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

[JSTL-ITA] "java.sql.SQLException: No suitable driver" with MySQL

843836Jun 11 2005 — edited Jul 10 2005
Hello boys,
i'm from Italy so my english is not good, i'm sorry :) .

I've the D:\www\public_html\WEB-INF\lib\mysql-connector-java-3.1.8-bin.jar

The "file.jsp" that i exec with Tomcat is:
<html>
<head><title>JDBC with JSTL</title></head>
<body>

<%@ taglib prefix="sql" uri="http://jakarta.apache.org/taglibs/sql" %>
<%@ taglib prefix="c" uri="http://jakarta.apache.org/taglibs/c" %>

<sql:setDataSource
  var="conn1"
  driver="com.mysql.jdbc.Driver"
  url="jdbc:mysql://localhost/queryjdbc"
  user="root"
  password="cane"
/>

<sql:query var="persone" dataSource="${conn1}">
SELECT * FROM persone ORDER BY cf
</sql:query>

<table border=1 align="center">
<thead><th>Codice Fiscale </th><th>Nome </th><th>Cognome </th></thead>
<tbody>
<c:forEach var="row" items="${persone.rows}">
    <tr>
        <td> <c:out value="${row.cf}"/> </td>
        <td> <c:out value="${row.name}"/> </td>
        <td> <c:out value="${row.cognome}"/> </td>
    </tr>
</c:forEach>
</tbody>
</table>
</body>
</html>
But the result is :(
EXEPTION
javax.servlet.ServletException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver"
	org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848)
	org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
	org.apache.jsp.prova_002djslt_002dmysql_jsp._jspService(org.apache.jsp.prova_002djslt_002dmysql_jsp:107)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
	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(Unknown Source)
	org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(Unknown Source)
	org.apache.jsp.prova_002djslt_002dmysql_jsp._jspx_meth_sql_query_0(org.apache.jsp.prova_002djslt_002dmysql_jsp:146)
	org.apache.jsp.prova_002djslt_002dmysql_jsp._jspService(org.apache.jsp.prova_002djslt_002dmysql_jsp:81)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs.
[Q1] Someone can explanme why this script don't work?!
The JDBC driver with DBTAGS working, i'm become crazy o_O ... ARGH!!

:P

TNX 4 the answer, if existe ...
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 7 2005
Added on Jun 11 2005
8 comments
333 views