上图是viewdata.jsp读取一个数据库表后显示所有数据的效果截图。已知Viewdata.jsp操作数据库是用jdbc-odbc桥方式,odbc数据源名称为grade,请完成程序。
- <%@page contentType=“text/html;charset=gb2312”%>
- <%@page import=“_____A_____ “%>
- <%Connection conn = null;
- Statement stmt = null;
- ResultSet rs = null;
- String strSQL = ““;
- try{
- Class.forName(“________B______”);
- }
- catch(ClassNotFoundException ce){}
- try{
- conn=DriverManager.__C_____ (“jdbc:odbc:___D___ “);
- stmt=conn._______E_____;
- strSQL = “SELECT * FROM grade”;
- rs = stmt._____F____ (strSQL); %>
- <TABLE BORDER=“1”>
- <tr><td>学号</td><td>姓名</td><td>语文</td><td>数学</td><td>英语</td></tr>
- <% ______G____{%>
- <tr>
- <td>____H_____</td>
- <td>____I_____</td>
- <td>_____J____</td>
- <td>_____K____</td>
- <td>_____L____</td>
- </tr>
- <%}%>
- </TABLE><%}//END TRY
- catch(Exception e){}
- finally{ stmt.close(); conn.close(); }
- %>
-