Presentation is loading. Please wait.

Presentation is loading. Please wait.

모바일 자바 프로그래밍 JDBC / WAP Ps lab 오민경.

Similar presentations


Presentation on theme: "모바일 자바 프로그래밍 JDBC / WAP Ps lab 오민경."— Presentation transcript:

1 모바일 자바 프로그래밍 JDBC / WAP Ps lab 오민경

2 JDBC란? 특정한 DBMS에 종속되지 않고 연결할 수 있는 방법을 제공 SQL을 사용하여 데이터베이스를 접근
ODBC를 통해서 데이터베이스를 엑세스 ODBC : MS사에서 만든 데이터베이스 연결 표준

3 JDBC를 구성하는 클래스 JDBC API는 java.sql 패키지로 구성 클래스 이름 설 명 DriverManager
설 명 DriverManager 드라이버 연결 Connection 데이터베이스 연결 Statement 질의 및 명령을 전달 ResultSet 질의에 의해 생성된 결과 ResultSetMetaData 생성된 결과의 구성

4 JDBC 프로그래밍 드라이버 등록 데이터베이스 연결
Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”); DriverManager는 뒤에 숨어있는 상태에서 드라이버가 로딩될 때 그 드라이버를 알아서 등록 forName은 클래스를 VM에 로딩하기 위한 목적 데이터베이스 연결 Connection con = DriverManager.getConnection(url, name, passwd); URL = jdbc:odbc:<데이터베이스 원본 이름>

5 JDBC 프로그래밍(cont.) SQL 구문 전달 질의로 얻어진 결과 표현
Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(SQL문); Statement : SQL 구문을 전달하기 위한 인터페이스 질의로 얻어진 결과 표현 rs.next(); rs.getString(i); next() : 다음줄로 커서를 옮김 getString(), getInt() : 원하는 컬럼의 데이터 읽기

6 JDBC 프로그래밍(cont.) ResultSet의 구성에 대한 정보 얻기 사용 후 자원 반환
ResultSetMetaData rsmd = rs.getMetaData(); rsmd.getColumnCount(); rsmd.getColumnLabel(i); getColumnCount() : 컬럼의 개수 getColumnLabel() : 해당 컬럼의 레이블명 사용 후 자원 반환 stmt.close(); con.close(); Statement와 Connection객체는 사용이 끝나면 반환 ResultSet은 Statement객체에 종속된 것임

7 WAP이란? WAP(Wireless Application Protocol) WAP 포럼이 무선 인터넷을 위하여 정의한 프로토콜

8 WAP이란?(cont.) [그림 2] WAP 네트워크

9 웹과 WAP [그림 3] 웹 서버 – 웹 클라이언트 모델

10 웹과 WAP(cont.) [그림 4] WAP 서비스 모델

11 WAP 프로토콜 [그림 5] WAP 프로토콜

12 WAP 프로토콜(cont.) [그림 6] WAP 어플리케이션 구현 방법 세 가지


Download ppt "모바일 자바 프로그래밍 JDBC / WAP Ps lab 오민경."

Similar presentations


Ads by Google