<%@ page contentType="text/html; charset=euc-kr" %> <%@ page import="java.sql.*" %> <%! static { try { Class.forName("COM.ibm.db2.jdbc.app.DB2Driver"); } catch(ClassNotFoundException e){ System.out.println( e.toString() ); } } %> <% Connection conn = null; Statement stmt = null; try { conn = DriverManager.getConnection("jdbc:db2:LWYDB", "db2admin", "db2admin"); stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("select * from emp"); while(rs.next()){ out.println("empno=" + rs.getString(1) + ", ename=" + rs.getString(2) + "
"); } rs.close(); } catch(Exception e){ out.println(e.toString()); } finally { if ( stmt != null ) try { stmt.close();}catch(Exception e){} if ( conn != null ) try { conn.close();}catch(Exception e){} } %>