我的JSP连接数据库的代码?请帮我看看。
<body>
<%! String data = "jdbc:odbc:Presidents"; %>
<%
try{
//加载驱动程序
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection(data,"","");
Statement stmt = conn.createStatement();
stmt.execute("SELECT Name FROM Contacts");
ResultSet rc = stmt.getResultSet();
}
%>
<table width="100%" border="1">
<th>本轮推荐:</th>
<% while(rc.next()) { %>
<tr>
<td><%= rc.getString("Name") != null ? ds.getString("Name") :" " %></td>
</tr>
<% } %>
</table>
<% stmt.close();
}catch(Exception e){
System.out.println("Error:" + e.toString() + e.getMessage());
}
%>
</body>
大侠,代码有错吗?