public static void main(String args[])  {
		ResultSet rs = null;
		Statement stmt = null;
		Connection conn = null;
//1
		try {
			Class.forName("oracle.jdbc.driver.OracleDriver");
//			new oracle.jdbc.driver.OracleDriver();
//2		
			conn = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:orcl", "scott", "tiger");
//3
			stmt = conn.createStatement();
			rs = stmt.executeQuery("select * from dept");
//4
			while(rs.next()) {
//5
				System.out.println(rs.getString("deptno"));
				System.out.println(rs.getInt("deptno"));
			}
		}catch (ClassNotFoundException e) {
			e.printStackTrace();
		}catch (SQLException e) {
			e.printStackTrace();
		} finally {
//6
			try {
				if(rs != null) {
					rs.close();
					rs = null;
				}
				if(stmt != null) {
					stmt.close();
					stmt = null;
				}
				if(conn != null) {
					conn.close();
					conn = null;
				}
			} catch (SQLException e) {
				e.printStackTrace();
			} 
		}
	}