JDBC 10

Procedure_insert_exception_CallableStatement

SQL Developer 에서 insert 에 제한을 주는 프로시저 pcd_tbl_member_test_insert 생성 create or replace procedure pcd_tbl_member_test_insert ( p_userid IN tbl_member_test.userid%type -- IN 은 생략 가능하다. (OUT 은 불가.) ==> 생략하면 IN 으로 본다. , p_passwd tbl_member_test.passwd%type , p_name tbl_member_test.name%type ) is v_length number(2); error_insert EXCEPTION; v_ch varchar2(1); v_flag_upper number(1) := 0; -- 대문자 표식 v_fla..

JDBC 2022.07.23

Procedure_select_one_CallableStatement

>>>> Stored Procedure 란? 2. 127.0.0.1 서버에 연결 >> 3. Connection conn 객체를 사용하여 prepareCall() 메소드를 호출함으로써 // CallableStatement cstmt 객체를 생성한다. // 즉, 우편배달부(택배기사) 객체 만들기 cstmt = conn.prepareCall("{call pcd_student_select_one(?,?,?,?,?,?,?)}"); 오라클 서버에 생성한 프로시저 pcd_student_select_one 의 매개변수 갯수가 7개 이므로 ? 를 7개 준다. 다음으로 오라클의 프로시저를 수행( executeUpdate() ) 하기에 앞서서 반드시 해야할 일은 IN mode 로 되어진 파라미터에 값을 넣어주고, OUT m..

JDBC 2022.07.23

DQL_select_PreparedStatement

public class DQL_select_PreparedStatement_02 { public static void main(String[] args) { Connection conn = null; // Connection conn 은 데이터베이스 서버와 연결을 맺어주는 자바의 객체이다. PreparedStatement pstmt = null; // PreparedStatement pstmt 은 Connection conn(연결한 DB 서버)에 전송할 SQL문(편지)을 전송(전달)을 해주는 객체(우편배달부)이다. ResultSet rs = null; // ResultSet rs 은 select 된 결과물이 저장되는 곳이다. Scanner sc = new Scanner(System.in); >>> 1. ..

JDBC 2022.07.22

DML_insert_PreparedStatement

오라클 SQL Developer 테이블 tbl_memo 생성 create table tbl_memo ( no number(4) , name varchar2(20) not null , msg varchar2(200) not null , writeday date default sysdate , constraint PK_tbl_memo_no primary key(no) ); -- Table TBL_MEMO이(가) 생성되었습니다. 시퀀스 seq_memo 생성 create sequence seq_memo start with 1 increment by 1 nomaxvalue nominvalue nocycle nocache; -- Sequence SEQ_MEMO이(가) 생성되었습니다. 이클립스 public class..

JDBC 2022.07.22

오라클 계정 생성하기

------ ====== ***** 오라클 계정 생성하기 시작 ***** ====== ------ -- 오라클 계정 생성을 위해서 sys 또는 system 으로 연결하여 작업을 해야 한다. [SYS 시작] -- show user; -- USER이(가) "SYS"입니다. -- 오라클 계정생성시 계정명앞에 c## 붙이지 않고 생성하기. alter session set "_ORACLE_SCRIPT"=true; -- Session이(가) 변경되었습니다. -- orauser1 이라는 오라클 일반사용자 계정을 생성한다. 암호는 aclass 이다. create user jdbc_user identified by aclass default tablespace users; -- User JDBC_USER이(가) 생성되었..

JDBC 2022.07.21