I got an error: java.sql.Exception: Base table or view not found, message from server: "Table 'mysql.students' doesn't exist"
I just installed JBoss and configured mySQL accordingly to the tutorials/manuals.
I do not know what is wrong here... is it my server, database, or code?
I just installed JBoss and configured mySQL accordingly to the tutorials/manuals.
I do not know what is wrong here... is it my server, database, or code?
| Code: |
|
<html> <head> <%@ page import = "java.io.*" import = "java.lang.*" import = "java.sql.*" %> <title> JSP Example 2 </title> </head> <body> <h1>JSP Example 3</h1> <% 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/mysql:3306/cmpsci320","root","[password]"); place = request.getParameter("place"); sql = dbconn.prepareStatement("SELECT * FROM students"); 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> |
