Presentation is loading. Please wait.

Presentation is loading. Please wait.

2011 년 11 월 23 일 제 13 장.  ORM 프레임워크인 iBATIS  MySQL 설치하기  iBATIS 를 사용한 JDBC  SQL Map API.

Similar presentations


Presentation on theme: "2011 년 11 월 23 일 제 13 장.  ORM 프레임워크인 iBATIS  MySQL 설치하기  iBATIS 를 사용한 JDBC  SQL Map API."— Presentation transcript:

1 2011 년 11 월 23 일 제 13 장

2  ORM 프레임워크인 iBATIS  MySQL 설치하기  iBATIS 를 사용한 JDBC  SQL Map API

3  ORM(Object Relational Mapping) 는 데이터베이 스와 객체를 연결 시켜준다. Table Object iBATIS

4  JDBC uses directly SQL query statement in source code.  ORM controls the SQL query statement by mapping between table and Java object  UserDao 클래스의 getUser(id) 함수 Table Java Object xml File

5 기본 sql 쿼리 문장 생성

6 ? 가 id 의 문자열로 대체됨 실제로 select * from USER USER_ID=hwlee 문장 실행

7

8  User.xml  User user = (User)sqlMap.queryForObject("getUser","hwlee");

9 mysqld port:3306 DBMS Application

10  MySql  MS Sql Server  Oracle  SyBase

11  Download : www.mysql.com ◦ Personal use : free ◦ Commercial use : buy

12  MySQL Community Edition

13  MySQL Community Server

14  Download MSI version

15  *.msi 더블 클릭

16

17

18

19

20

21

22  MySQL 명령 프롬프트 사용

23

24  두 개의 데이터베이스 제공

25  show databases;

26  Use 데이터베이스명 ;

27  show tables;

28  create database 이름 ; ◦ create database userdb;  drop database 이름 ; ◦ drop database userdb;

29  Create table 이름 ( 컬럼명 자료형, …); 컬럼명자료형설명 USER_IDvarchar(20)Primary key, 사용자 ID USER_PWvarchar(20) 사용자 암호 USER_NAMEvarchar(20) 사용자 이름

30  insert into 테이블명 [( 컬럼, …)] values(data, …); USER_IDUSER_PWUSER_NAME hwlee1234Lee Hyung Won root1234Supervisor

31  select [all | distinct] 컬럼목록 from 테이블목록 [where 조건 ] [group by 컬럼목록 ] [having 조건 ] [order by 컬럼목록 [asc | desc]]

32  www.mysql.com/downloads

33

34

35

36

37  commons.apache.org

38

39

40  iBATIS 는 myBATIS 로 바뀌었음  http://code.google.com/p/mybatis/wiki/Dow nloads?tm=2

41  iBATIS 는 myBATIS 로 바뀌었음  http://www.mybatis.org

42  Project : Chapter13  Library Copy ◦ mysql ◦ dbcp ◦ pool ◦ iBatis

43  src Directory 이 파일이 어느 DB 에 어떻게 연결하는가를 알려 준다.

44

45  SqlMapConfig.xml 파일 : src Directory

46

47

48  ◦ 외부의 프로퍼티 파일을 사용할 때  JTAcom.ibatis.sqlmap.engine.transaction.jta.JtaTransaction Config JDBCcom.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransac tionConfig EXTERNALcom.ibatis.sqlmap.engine.transaction.external.External TransactionConfig

49   Java Naming and Directory Interface SIMPLEcom.ibatis.sqlmap.engine.datasource.SimpleDataSourc eFactory DBCPcom.ibatis.sqlmap.engine.datasource.DbcpDataSourceF actory JNDIcom.ibatis.sqlmap.engine.datasource.JndiDataSourceFa ctory

50  JDBCJDBC 사용 JTAJava Transaction API(JTA) 사용 EXTERNAL 사용자가 직접 transaction control

51  y2011.ch13.model.User.java 추가

52  queryForObject()  queryForList()

53

54

55

56  src/User.xml

57

58  y2011.ch13

59

60


Download ppt "2011 년 11 월 23 일 제 13 장.  ORM 프레임워크인 iBATIS  MySQL 설치하기  iBATIS 를 사용한 JDBC  SQL Map API."

Similar presentations


Ads by Google