如何將數(shù)據(jù)庫(kù)查詢到的結(jié)果輸出在頁(yè)面上?
publicclassOraDriver{publicstaticvoidmain(Stringargs[])throwsException{//利用Oracle驅(qū)動(dòng)進(jìn)行連接Class.forName("oracle.jdbc.driver.OracleDriver")
;//載入驅(qū)動(dòng)Stringurl="jdbc:oracle:thin:@localhost:1521:SCHOOL"
;Connectionconn=DriverManager.getConnection(url,"scott","tiger")
;Statementstat=conn.createStatement()
;ResultSetrs=stat.executeQuery("SELECT姓名FROM學(xué)籍")
;while(rs.next()){System.out.println(rs.getString("姓名"));}}}