<%@ page session="false" %> <%@ page import="java.sql.*" %> <% try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); System.out.println("JDBC driver loaded"); } catch (ClassNotFoundException e) { System.out.println(e.toString()); } %> Display All Users

Displaying All Users



<% String sql = "SELECT FirstName, LastName, UserName, Password" + " FROM Users"; try { Connection con = DriverManager.getConnection("jdbc:odbc:JavaWeb"); Statement s = con.createStatement(); ResultSet rs = s.executeQuery(sql); while (rs.next()) { %> <% } rs.close(); s.close(); con.close(); } catch (SQLException e) { } catch (Exception e) { } %>
First Name Last Name User Name Password
<% out.print(rs.getString(1)); %> <% out.print(rs.getString(2)); %> <% out.print(rs.getString(3)); %> <% out.print(rs.getString(4)); %>