I was trying to connect JSP to MySQL and the server am using is Xamp's Tomcat, but all in vain, i have watched all tutorials but they are not working. 1: i have installed JDBC connector too. 2: am working in NET BEANS
files am importing are
<%@ page import="java.util.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>
and the method am using is
<%
Connection conn = null;
Statement st = null;
ResultSet rs = null;
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:mysql://localhost/userdetails");
st = conn.createStatement();
rs = st.executeQuery("select * from user");
while(rs.next()) { %>
<tr>
<td><% rs.getString("id"); %></td><td><% rs.getString("idd"); %></td>
</tr>
<% }
%>
and is there any proper way to come to know what is the main error? because i am really not getting it, where am wrong
I have tried jdbc:mysql://localhost:3306/userdetails also.