suitable mysql driver
Hi, I'm facing some difficulties in connecting my examples in Beginning JSP chapter 03 (Data Access).The error message are:
-->Unable to locate suitable driver.
For your info, I included all the jar files as intructed in the book (mysql-connector-java-2.0.14-bin.jar also included).
Its funny when i tried NON-JSTL codes to connect to mysql, it seems to be ok and and it produce the same results. The non-JSTL code are as follows :
<%@ page import="java.sql.*" %>
<%
String connectionURL = "jdbc:mysql://localhost:3306/publish/user=;password=";
Connection connection = null;
Statement statement = null;
ResultSet rs = null;
%>
<html><body>
<table border=1>
<tr>
<td>ID</td><td>Title</td><td>Price</td>
</tr>
<%
Class.forName("com.mysql.jdbc.Driver").newInstance ();
connection = DriverManager.getConnection(connectionURL, "publish", "wrox");
statement = connection.createStatement();
rs = statement.executeQuery("SELECT * FROM book");
%>
<%
while (rs.next()) {
out.println("<tr>");
out.println(" <td>" + rs.getString("ID")+"</td>");
out.println(" <td>" + rs.getString("title")+"</td>");
out.println(" <td>" + rs.getString("price")+"</td>");
out.println("</tr>");
}
rs.close();
%>
</table>
</body></html>
In order to use the JSTL code in chapter03 examples, do i have to make some entries in web.xml?
Thanks
|