This is the code where I have allocated the driver, when compiled does not give me any
error the problem is when I open the file after put in it in the tomcat folder.
<%@page contentType="text/html"%>
<html>
<head>
<%@ page
import = "java.io.*"
import = "java.lang.*"
import = "java.sql.*"
%>
<title>JSP Page</title>
</head>
<body>
<h1>JSP Example 3</h1>
<%-- <jsp:useBean id="beanInstanceName" scope="session" class="package.class" /> --%>
<%-- <jsp:getProperty name="beanInstanceName" property="propertyName" /> --%>
<%
String place;
Connection dbconn;
ResultSet results;
PreparedStatement sql;
try
{
Class.forName("org.gjt.mm.mysql.Driver");
try
{
int latitude,longitude,easting,northing;
boolean doneheading = false;
dbconn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/prueba?user=fusterjj&password=juanjo");
place = request.getParameter("place");
sql = dbconn.prepareStatement("SELECT * FROM DB1 = '" + place + "'");
results = sql.executeQuery();
while(results.next())
{
if(! doneheading)
{
out.println("<table border=2>");
doneheading = true;
}
latitude = results.getInt("latitude");
longitude = results.getInt("longitude");
easting = results.getInt("easting");
northing = results.getInt("northing");
out.println("<tr><td>" + latitude);
out.println("<td>" + longitude);
out.println("<td>" + easting);
out.println("<td>" + northing);
}
if(doneheading)
{
out.println("</table>");
}
else
{
out.println("No matches for " + place);
}
}
catch (SQLException s)
{
out.println("SQL Error<br>");
}
}
catch (ClassNotFoundException err)
{
out.println("Class loading error");
}
%>
</body>
</html>