I want to search record in sql server database and then show it in the web page using jsp. How can I do this please help me. My code is also given bellow. Thanks
<%
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection ("jdbc:mysql://localhost:3306/mydb","root","root");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM test where firstName = ?");
while (rs.next()){
%>
<tr bgcolor="#Abc">
<td> <%=rs.getString("firstName")%> </td>
<td><%=rs.getString("lastname")%></td>
</tr>
<%
}
}catch (Exception ex){
System.out.println(ex.getMessage());
}
%>