Ola pessoal, é o seguinte.... A baixo esta um código q estou desenvolvendo, muito besta, pra ver como funciona.... gostaria de saber o q esta errado, pois não esta funcionando... agradeço desde já!
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<%
try {
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Connection con = DriverManager.getConnection("jdbc:sqlserver:PONS","sa", "");
System.out.println("got connection");
Statement s = con.createStatement();
sql = "SELECT * FROM Employees";
ResultSet rs = s.executeQuery(sql);
%>
<table width="200" border="1">
<% while (rs.next()) {%>
<tr>
<td><%= rs.getString(1)%></td>
<td><%= rs.getString(2)%></td>
</tr>
<%
}
rs.close();
s.close();
con.close();
}
catch (ClassNotFoundException e1) {
System.out.println(e1.toString());
}
catch (SQLException e2) {
System.out.println(e2.toString());
}
catch (Exception e3) {
System.out.println(e3.toString());
}%>
</table>
</body>
</html>