메뉴 건너뛰기

조회 수 4266 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄 첨부
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄 첨부

일반 사용자 생성



데이터베이스 접속

1. Workspace 생성







 


2. Table 생성











3. Database 연결 및 Column 추가

  1. import java.sql.*;
  2.  
  3. public class JdbcEx01 {
  4.     // ctrl space 자동완성기능
  5.     public static void main(String[] args) {
  6.         try {
  7.             //1. 드라이버 검색
  8.             Class.forName("oracle.jdbc.driver.OracleDriver");
  9.             //2. DB 연결을 시도
  10.             Connection conn // Connection 객체가 DB연결해준다.
  11.             =DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe""ED""1234");
  12.             // 드라이버매니저가 접속해야되는 url, id, pass
  13.             System.out.println("DB 연결 성공");
  14.             // 3. 쿼리를 날릴 수 있다.
  15.             // DB에게 날릴 문장을 잘 감싸서 전송을 시켜야되는데
  16.             String sql = "insert into sample values('king', '1234', '킹', '99)";
  17.             // 정적인 포장지; SQL 쿼리를 전송시킬수있는 객체
  18.             Statement st = conn.createStatement();
  19.            
  20.             //4. 작성한 쿼리를 날린다.
  21.             int n = st.executeUpdate(sql);
  22.                         // st.executeQuery(sql);
  23.             System.out.println(n+"개의 행이 조작되었습니다.");
  24.            
  25.             //5. 자원반납
  26.             st.close();
  27.             conn.close();
  28.            
  29.         }catch(ClassNotFoundException e) {
  30.             e.printStackTrace();
  31.         }catch(SQLException e) {
  32.             e.printStackTrace();
  33.         }
  34.     }
  35. }





  1. Oracle Database DB연결, table 생성

    Date2017.09.11 Views4266
    Read More
  2. JSP 동작 원리, 내부 객체

    Date2017.09.12 Views3579
    Read More
  3. 스크립틀릿(Scriptlet), 선언(declaration), 표현식(expression)

    Date2017.09.12 Views3637
    Read More
  4. 지시자(Directive)

    Date2017.09.12 Views3123
    Read More
  5. 주석(comments)

    Date2017.09.12 Views3114
    Read More
  6. request, response

    Date2017.09.12 Views3220
    Read More
  7. JSP 게시판 만들기 - 구현 (이클립스 웹 프로젝트 생성)

    Date2017.09.12 Views4885
    Read More
  8. JSP 게시판 만들기 - 구현 (이클립스 웹 프로젝트 생성)

    Date2017.09.12 Views13395
    Read More
  9. JSP 게시판 만들기 - 개발표준, 화면설계

    Date2017.09.12 Views6597
    Read More
  10. JSP 게시판 만들기 - 시스템 아키텍처

    Date2017.09.12 Views4781
    Read More
  11. JSP (Java Server Page), Servlet에 대해

    Date2017.09.12 Views6710
    Read More
  12. JSP 게시판 만들기 - 네이밍, 데이터베이스 설계

    Date2017.09.12 Views4981
    Read More
  13. JSP 게시판 만들기 - 구현 (웹 프로젝트와 톰켓 연동, 샘플 페이지 작성)

    Date2017.09.12 Views5185
    Read More
  14. JSP 게시판 만들기 - 구현 (디렉토리, 파일, 테이블 생성)

    Date2017.09.12 Views7909
    Read More
  15. JSP 게시판 만들기 - 구현 (HTML 코딩)

    Date2017.09.12 Views17066
    Read More
  16. JSP 게시판 만들기 - 구현 (MySQL과의 연동)

    Date2017.09.12 Views37896
    Read More
  17. JSP 게시판 만들기 - 구현 (Method, Query 기초)

    Date2017.09.12 Views30633
    Read More
  18. JSP 게시판 만들기 - 구현 (파라미터, 요청/응답)

    Date2017.09.12 Views4799
    Read More
  19. JSP 게시판 만들기 - 구현 (마무리, 테스트)

    Date2017.09.12 Views6581
    Read More
  20. JSP 게시판 만들기 - 완료 (소스파일, 의견)

    Date2017.09.12 Views5511
    Read More
Board Pagination Prev 1 2 3 4 Next
/ 4

하단 정보를 입력할 수 있습니다

© k2s0o1d4e0s2i1g5n. All Rights Reserved