Gentle Breeze
JDBC Sample 본문
package com.sds.jdbc.board;
import java.sql.*;
public class SearchBoardList {
private Connection conn;
private Statement stmt;
private ResultSet rs;
private String driver = "oracle.jdbc.driver.OracleDriver";
private String url = "jdbc:oracle:thin:@127.0.0.1:1521:XE";
private String id = "hr";
private String pass = "hr";
private String sql = " select * from board ";
public void getBoardList(){
try {
Class.forName(driver);
conn = DriverManager.getConnection(url, id, pass);
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
while(rs.next()){
System.out.print("SEQ : " + rs.getString("seq") + "\t\t");
System.out.println("TITLE : " + rs.getString("title"));
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
rs.close();
stmt.close();
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
public static void main(String[] args) {
SearchBoardList sb1 = new SearchBoardList();
sb1.getBoardList();
}
}
'⑦ IFSS 방법론 > IFSS 기초(개발자)' 카테고리의 다른 글
XML <3> (0) | 2008.10.06 |
---|---|
XML 실습 - bml.xml (0) | 2008.10.06 |
XML <2> (0) | 2008.10.06 |
XML <1> (0) | 2008.10.06 |
[정리] IFSS 1일차 (0) | 2008.10.06 |