I am creating my first java web application.. Actually the problem I am facing is in ManageAllStudents. It should show the list of information of students after retrieving it from the database.
I'm using the below code but it doesn't show the information or doesn't retrieve the information from the database.
Kindly guide me what I am missing. This is my code:
<% try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url = "jdbc:odbc:stdProjectDataDSN";
Connection c = DriverManager.getConnection(url);
String sql = "Select * from students ORDER BY ID DESC";
PreparedStatement pStmt = c.prepareStatement(sql);
ResultSet rs = pStmt.executeQuery(sql);
while (rs.next()) {
%>
<tr height="40">
<th> <%=rs.getString("ID")%> </th>
<th> <%=rs.getString("Name")%> </th>
<th> <%=rs.getString("RollNumber")%> </th>
<th> <%=rs.getString("PhoneNumber")%> </th>
<th> <%=rs.getString("StudyProgram")%> </th>
<th> <%=rs.getString("Status")%> </th>
<th> <a href="ManageAllStudent.jsp">update</a> </th>
<th> <a href="ManageAllStudent.jsp">delete</a> </th>
</tr>
<%
}
rs.close();
pStmt.close();
c.close();
}
catch (Exception e) {
}
%>