StringTokenizer

package dateex;

import java.util.StringTokenizer;

public class StringTokenizer1 {
	public static void main(String[] args) {
		
		StringTokenizer st = new StringTokenizer("a=3,b=5,c=6", ","); // 구분자로 ',' 사용
		
		while (st.hasMoreTokens()) {
			System.out.println(st.nextToken());
		}
		
	}
}

.

사인 코사인

 

 

숙제

 

데이터 베이스의 속성

데이터베이스의 속성들은 현실 세계의 개념들과 일치해야한다

1.현실세계의 개념 : 이름 나이 등

2.정보 모델링(ER다이어그램) : 개체1--- 관계 --- 개체2

3.논리적 모델(관계 데이터 모델)

4.데이터베이스의 속성 :

이름 나이
홍길동 30
한사전 25

 

데이터베이스 생명주기

1.요구사항분석
사용자들의 요구사항을 듣고 분석,
데이터베이스 구축의 범위를 정하는 단계

2.설계
분석된 요구사항을 기초로 주요 개념과 업무 프로세스 등을 식별하고(개념적 설계),
사용하는 DBMS의 종류에 맞게 변환(논리적 설계)한 후,
데이터베이스 스키마를 도출(물리적 설계)

3.구현
설계 단계에서 생성한 스키마를 실제 DBMS에 적용하여 테이블 및 관련 객체(, 인덱스 등)를 만듦

4.운영
구현된 데이터베이스를 기반으로 소프트웨어를 구축하여 서비스를 제공

5.감시 및 개선
데이터베이스 운영에 따른 시스템의 문제를 관찰하고 데이터베이스 자체의 문제점을 파악하여 개선

 

개념적 모델링

요구사항을 수집하고 분석한 결과를 토대로 업무의 핵심적인 개념을 구분하고 전체적인 뼈대를 만드는 과정

개체(entity)를 추출하고 각 개체들 간의 관계를 정의하여 ER 다이어그램(ERD, Entity Relationship Diagram)을 만드는 과정까지를 말함

 

논리적 모델링

개념적 모델링에서 추출하지 않았던 상세 속성도 추출

정규화, 데이터표준화

 

물리적 모델링(physical modeling)

작성된 논리적 모델을 실제 컴퓨터의 저장 장치에 저장하기 위한 물리적 구조를 정의하고 구현하는 과정

DBMS의 특성에 맞게 저장 구조를 정의해야 데이터베이스가 최적의 성능을 낼 수 있음

CREATE TABLE Book (
  bookid      INT PRIMARY KEY, 
  bookname    VARCHAR(40),
  publisher   VARCHAR(40),
  price       INT 
);

 물리적 모델링시 트랜잭션, 저장 공간 설계 측면에서

1. 응답시간 최소화

2.트랜잭션 동시 발생한도 검토

3.저장공간 효율적 배치

 

ER모델

ER(Entity Relationship) 모델 : 세상의 사물을 개체(entity)와 개체 간의 관계(relationship)로 표현함

*개체(entity) : 독립적인 의미를 지니고 있는 유무형의 사람 또는 사물. 개체의 특성을 나타내는 속성(attribute)에 의해 식별됨. 개체끼리 서로 관계를 가짐.

남편 -- 결혼하다 -- 아내

 

ER 다이어그램

ER 모델은 개체와 개체 간의 관계를 표준화된 그림으로 나타냄

*직원한명이 여러 프로젝트에 참여 할 수 있기 때문에 1:N

 

개체 타입의 유형

강한 개체(strong entity) : 다른 개체의 도움 없이 독자적으로 존재할 수 있는 개체

ex ) 직원

약한 개체(weak entity) : 독자적으로는 존재할 수 없고 반드시 상위 개체 타입을 가짐

ex ) 직원의 가족 (해당 직원이 없으면 )

 

속성(attribute)

개체가 가진 성질

사람 - 이름, 나이

 

관계타입 유형

차수에 따른 유형

1진 관계 : 개체 하나로 관계를 만드는 것 

임꺽정의 멘토는 같은 테이블의 1번인 홍길동이기 때문에 1테이블로 관계를 만들 수 있다

번호 이름 멘토
1 홍길동  
2 임꺽정 1

개체1 --- 관계 --- 개체1

 

2진 관계 : 두개의 개체가 관계를 맺음

3진 관계 : 3개의 개체가 관계를 맺음

 

대응수(카디널리티)에 따른 유형

관계 대응수(cardinality) : 두 개체 타입의 관계에 실제로 참여하는 개별 개체

1:1 대응 ex) 직원들은 사무실에 각각의 컴퓨터를 1대씩 할당 받았다 

1:N 대응 ex) 각 학과에 여러학생들이 있다

N:M 대응 ex) 학생들은 여러 강좌를 들을 수 있다

 

ISA 관계

상위개체와 하위개체

 

참여 제약조건

그런경우는 잘 없지만 전체참여인 경우를 알아두자

 

역할

 

IE 표기법

 

ER모델을 관계 데이터 모델로 매핑(사상)

 

개체 타입의 사상

'Database > OracleSQL' 카테고리의 다른 글

데이터베이스 ALL, SOME  (0) 2020.05.06
데이터베이스 무결성  (0) 2020.04.27
자바 데이터베이스에서 자료 가져오기  (0) 2020.04.22
200409  (0) 2020.04.09
오라클 예제 및 문제  (0) 2020.04.08
<%@ page import = "java.sql.*" contentType = "text/html;charset=EUC-KR"%>
<%
Class.forName("oracle.jdbc.driver.OracleDriver");
String url = "jdbc:oracle:thin:@localhost:1521:xe";
Connection dbconn = DriverManager.getConnection(url, "c##madang", "c##madang");
Statement stmt = dbconn.createStatement();
ResultSet myResultSet = stmt.executeQuery("SELECT * FROM Book");
%>
<html>

<head>
<meta http-equiv="content-type" content="text/html; charset=euc-kr">
<title>** BOOK LIST**</title>
</head>

<body bgcolor = "white" text = "black" link = "blue" vlink = "purple" alink = "red">
<table border = "1" cellspacing = "0" width = "400" bordercolor = "#9AD2F7"
			bordercolordark = "white" bordercolorlight = "#B9E0FA">
		<tr> 
			<td width = "150" height = "20" bgcolor = "#D2E9F9">
			<p align = "center">
			<span style = "font-size : 8pt;"><b>BOOKNAME</b></span></p>
			</td>
			<td width = "150" height = "20" bgcolor = "#D2E9F9">
			<p align = "center">
			<span style = "font-size : 8pt;"><b>PUBLISHER</b></span></p>
			</td>
			<td width = "50" height = "20" bgcolor = "#D2E9F9">
			<p align = "center">
			<span style = "font-size : 8pt;"><b>PRICE</b></span></p>
			</td>
		</tr>
<%
if(myResultSet != null) {
	while(myResultSet.next()){
		String W_BOOKID = myResultSet.getString("bookid");
		String W_BOOKNAME = myResultSet.getString("bookname");
		String W_PUBLISHER = myResultSet.getString("publisher");
		String W_PRICE = myResultSet.getString("price");
%>
	<tr>
		<td width = "150" height = "20">
			<p><span style = "font-size : 9pt;">
			<a href="bookview.jsp?bookid=<%=W_BOOKID%>">
			<font face = "돋움체" color = "black">
			<%=W_BOOKNAME%></font></a></span></p>
		</td>
		<td width = "150" height = "20">
			<p align = "center"><span style = "font-size : 9pt;">
			<font face = "돋움체"><%=W_PUBLISHER%></font></span></p>
		</td>
		
		<td width = "50" height = "20">
			<p align = "center"><span style = "font-size : 9pt;">
			<font face = "돋움체"><%=W_PRICE%></font></span></p>
		</td>
	</tr>
<%
		}
	}
	stmt.close();
	dbconn.close();
%>
</table>
<table cellpadding = "0" cellspacing = "0" width = "400" height = "23">
	<tr>
		<td width = "1350">
			<p align = "right"><b>
			<font size = "1" face = "돋움체" color = "black">LIST</b></p>
		</td>
	</tr>
</table>
</body>
</html>

 

<%@ page import="java.sql.*" contentType="text/html; charset=EUC_KR" %>
<%
	Class.forName("oracle.jdbc.driver.OracleDriver");
	String url = "jdbc:oracle:thin:@localhost:1521:xe";
	Connection dbConn = DriverManager.getConnection(url, "c##madang", "c##madang");
	Statement stmt = dbConn.createStatement();
	String bookid = request.getParameter("bookid");
	ResultSet myResultSet = stmt.executeQuery("SELECT * FROM book WHERE bookid=" +bookid);
	if(myResultSet != null){
		myResultSet.next();
%>
<html>

<head>
<meta http-equiv="content-type" content="text/html; charset=euc-kr">
<title> ** Book VIEW **</title>
</head>


<body bgcolor = "white" text = "black" link = "blue" vlink = "purple" alink = "red">
<table border = "1" cellspacing = "0" width = "400" bordercolor = "#9AD2F7"
			bordercolordark = "white" bordercolorlight = "#B9E0FA">
			
			<tr>
				<td width="150" height="23">
					<p align="center">
					<span style="font-size: 9pt;">책 제 목</span></p>
				</td>
				<td width="513">
					<p><span style="font-size: 9pt;">
					<%=myResultSet.getString("BOOKNAME")%></span></p>
				</td>
			</tr>
			<tr>
				<td width="150" height="23">
					<p align="center">
					<span style="font-size: 9pt;">출 판 사</span></p>
				</td>
				<td width="513">
					<p><span style="font-size: 9pt;">
					<%=myResultSet.getString("PUBLISHER")%></span></p>
				</td>
			</tr>
			<tr>
				<td width="150" height="23">
					<p align="center">
					<span style="font-size: 9pt;">가 격</span></p>
				</td>
				<td width="513">
					<p><span style="font-size: 9pt;">
					<%=myResultSet.getString("PRICE")%></span></p>
				</td>
			</tr>
</table>
<table cellpadding="0" cellspacing="0" width = "400" height="23">
	<tr>
		<td width="150">
			<p align="right"><span style="font-size: 9pt">
			<a href="booklist.jsp?">
			<font color="black">목록</font></a></span></p>
		</td>
	</tr>
</table>
<% 
	}
	stmt.close();
	dbConn.close();
%>
</body>

</html>

 

'Web > Jsp' 카테고리의 다른 글

자바스크립트의 역할  (1) 2020.05.19
QueryBean  (0) 2020.05.19
out.print  (0) 2020.05.19
이클립스에 톰캣 설치하기  (0) 2020.04.23
회원가입 예제1  (0) 2020.03.05

디자인 - 설계라는 뜻

모델 - 구조

데이터 모델링 - 데이터 구조를 어떻게 만들 것 인가

1. 데이터
변수 배열 객체 객체배열 모두가 데이터
데이터가 모이면 파일
파일들이 모이면 데이터베이스

2. UI

3. 제어(처리)
if switch for while

 

유즈케이스 다이어그램

클래스 다이어그램

시퀀스 다이어그램

요구사항 분석서

화면설계서 - 만들려는 프로그램의 UI를 그림으로 그림 

ER 다이어그램

테이블설계서

 

개념적 > 논리적 > 물리적 모델링

 

------------------------

웹클라이언트 - 사용자가 보는 화면
HTML - 문서의 구조, 배치, 구성 
CSS - 스타일, 디자인
JavaScript - 제어, 이벤트

디버깅은 웹브라우저에서 해야한다(vscode나 이클립스 등에서 하긴 어렵다)

 

'낙서장' 카테고리의 다른 글

자바 네이버 지도 api 사용하기 (프로젝트 대비)  (0) 2020.04.27
200424  (0) 2020.04.24
200417 // API, SDK, synchronized, Object클래스, 임계구역  (0) 2020.04.17
uefi로 윈도우 설치했을경우 gpt  (0) 2020.04.16
200410  (0) 2020.04.10

------------------------

PHP, JSP 가 보이면 서버라고 보면 된다

JSP장점
자바와 같이 쓸 수 있다(기능을 다양하게 쓸 수 있다)

JSP는 Java코드에 +@JSP코드 + HTML코드 로 구성된다

다이나믹 웹 프로젝트

아파치 톰캣 (지금은 이클립스 안에서 돌아가도록 실습)

이클립스 엔터프라이즈나 STS툴을 써야한다

관리자권한으로 실행

 

 

 

 

'Web > Jsp' 카테고리의 다른 글

자바스크립트의 역할  (1) 2020.05.19
QueryBean  (0) 2020.05.19
out.print  (0) 2020.05.19
데이터베이스의 자료를 Jsp를 이용하여 출력하기  (0) 2020.04.23
회원가입 예제1  (0) 2020.03.05

데이터 베이스에서 자료 가져오기

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class BookList {
	Connection con; // 멤버변수
	String query;
	Statement stmt;
	ResultSet rs;

	public BookList() {

		// 11g express edition은 orcl 대신 XE를 입력한다
		
		// 연결 문자열
		String url = "jdbc:oracle:thin:@localhost:1521:XE";

		String userid = "c##madang";
		String pwd = "c##madang";

		try { // 드라이버를 찾는 과정
			
			// 파일 입출력(자바 파일 검색)
			Class.forName("oracle.jdbc.driver.OracleDriver");
			System.out.println("드라이버 로드 성공");
		} catch (Exception e) {
		}

		try { // 데이터베이스를 연결하는 과정
			System.out.println("데이터베이스연결 준비...");
			
			// 네트워크 입출력 + 객체 생성
			con = DriverManager.getConnection(url, userid, pwd);
			System.out.println("데이터베이스연결 성공");
		} catch (Exception e) {
		}
	}

	private void printBook() throws Exception {
		query = "SELECT * FROM Book"; // sql문
		stmt = con.createStatement();
		rs = stmt.executeQuery(query);
		System.out.println("BOOK NO \tBOOK NAME \t\tPUBLISHER \tPRICE");
		while (rs.next()) { // 한줄씩 읽는다 (튜플)
			System.out.print("\t" + rs.getInt(1));
			System.out.print("\t" + rs.getString(2));
			System.out.print("\t\t" + rs.getString(3));
			System.out.println("\t" + rs.getInt(4));
		}
		con.close();

	}

	public static void main(String[] args) {
		BookList so = new BookList();
		try {
			so.printBook();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

 

파일을 나눠보자

BookList.java

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class BookList {
	Connection con;

	public BookList() {

		// 11g express edition은 orcl 대신 XE를 입력한다
		String url = "jdbc:oracle:thin:@localhost:1521:XE";

		String userid = "c##madang";
		String pwd = "c##madang";

		try { // 드라이버를 찾는 과정
			Class.forName("oracle.jdbc.driver.OracleDriver");
			System.out.println("드라이버 로드 성공");
		} catch (Exception e) {
		}

		try { // 데이터베이스를 연결하는 과정
			System.out.println("데이터베이스연결 준비...");
			con = DriverManager.getConnection(url, userid, pwd);
			System.out.println("데이터베이스연결 성공");
		} catch (Exception e) {
		}
	}

	void printBook() throws Exception {
		String query = "SELECT bookid, bookname, publisher, price FROM Book"; // sql문
		Statement stmt = con.createStatement();
		ResultSet rs = stmt.executeQuery(query);
		System.out.println("BOOK NO \tBOOK NAME \t\tPUBLISHER \tPRICE");
		while (rs.next()) {
			System.out.print("\t" + rs.getInt(1));
			System.out.print("\t" + rs.getString(2));
			System.out.print("\t\t" + rs.getString(3));
			System.out.println("\t" + rs.getInt(4));
		}
		con.close();
	}
}

 

CustomerList.java

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class CustomerList {
	Connection con;

	public CustomerList() {

		// 11g express edition은 orcl 대신 XE를 입력한다
		String url = "jdbc:oracle:thin:@localhost:1521:XE";

		String userid = "c##madang";
		String pwd = "c##madang";

		try { // 드라이버를 찾는 과정
			Class.forName("oracle.jdbc.driver.OracleDriver");
			System.out.println("드라이버 로드 성공");
		} catch (Exception e) {
		}

		try { // 데이터베이스를 연결하는 과정
			System.out.println("데이터베이스연결 준비...");
			con = DriverManager.getConnection(url, userid, pwd);
			System.out.println("데이터베이스연결 성공");
		} catch (Exception e) {
		}
	}
	
	void printCustomer() throws Exception {
		String query = "SELECT custid, name, address, phone FROM customer"; // sql문
		Statement stmt = con.createStatement();
		ResultSet rs = stmt.executeQuery(query);
		System.out.println("custid \tname \t\taddress \tphone");
		while (rs.next()) {
			System.out.print("\t" + rs.getInt(1));
			System.out.print("\t" + rs.getString(2));
			System.out.print("\t\t" + rs.getString(3));
			System.out.println("\t" + rs.getString(4));
		}
		con.close();
	}
}

 

Basic.java

프로그램을 실행할 main 스택이 있는 클래스

public class Basic {
	public static void main(String[] args) {
		BookList so = new BookList();
		try {
			so.printBook();
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		CustomerList cl = new CustomerList();
		try {
			cl.printCustomer();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

 

 

------------------

변수를 사용하는 방법

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class CustomerList {
	Connection con;
	
	int custId;
	String name;
	String adress;
	String phone;

	public CustomerList() {

		// 11g express edition은 orcl 대신 XE를 입력한다
		String url = "jdbc:oracle:thin:@localhost:1521:XE";

		String userid = "c##madang";
		String pwd = "c##madang";

		try { // 드라이버를 찾는 과정
			Class.forName("oracle.jdbc.driver.OracleDriver");
			System.out.println("드라이버 로드 성공");
		} catch (Exception e) {
		}

		try { // 데이터베이스를 연결하는 과정
			System.out.println("데이터베이스연결 준비...");
			con = DriverManager.getConnection(url, userid, pwd);
			System.out.println("데이터베이스연결 성공");
		} catch (Exception e) {
		}
	}
	
	// 변수를 쓰는 방법
	void getCustomer() throws Exception {
		String query = "SELECT custid, name, address, phone FROM customer"; // sql문
		Statement stmt = con.createStatement();
		ResultSet rs = stmt.executeQuery(query);
		System.out.println("custid, tname, address, phone");
		while (rs.next()) {
			custId = rs.getInt(1);
			name = rs.getString(2);
			adress = rs.getString(3);
			phone = rs.getString(4);
			
			printCustomer();
		}
		con.close();
	}
	
	void printCustomer() throws Exception {
		System.out.println(custId + ", " + custId + ", " + adress + ", " + phone);
	}

}

 

배열을 사용하는 방법

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class CustomerList {
	Connection con;
	
	int custIdArr[] = new int[10];
	String nameArr[] = new String[10];
	String adressArr[] = new String[10];
	String phoneArr[] = new String[10];
	
	

	public CustomerList() {

		// 11g express edition은 orcl 대신 XE를 입력한다
		String url = "jdbc:oracle:thin:@localhost:1521:XE";

		String userid = "c##madang";
		String pwd = "c##madang";

		try { // 드라이버를 찾는 과정
			Class.forName("oracle.jdbc.driver.OracleDriver");
			System.out.println("드라이버 로드 성공");
		} catch (Exception e) {
		}

		try { // 데이터베이스를 연결하는 과정
			System.out.println("데이터베이스연결 준비...");
			con = DriverManager.getConnection(url, userid, pwd);
			System.out.println("데이터베이스연결 성공");
		} catch (Exception e) {
		}
	}
	
	// 배열을 쓰는 방법
	void getCustomer() throws Exception {
		String query = "SELECT custid, name, address, phone FROM customer"; // sql문
		Statement stmt = con.createStatement();
		ResultSet rs = stmt.executeQuery(query);
		
		int index = 0;
		while (rs.next()) {
			custIdArr[index] = rs.getInt(1);
			nameArr[index] = rs.getString(2);
			adressArr[index] = rs.getString(3);
			phoneArr[index] = rs.getString(4);
			
			index++;
		}
		con.close();
	}
	
	void printCustomer() throws Exception {
		System.out.println("custid, tname, address, phone");
		for (int i = 0; i < 10; i++) {
			System.out.println(custIdArr[i] + ", " + nameArr[i] + ", " + adressArr[i] + ", " + phoneArr[i]);
		}
	}

}

 

객체를 사용하는 방법

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class CustomerList {
	Connection con;

	int index;

	// 객체를 쓰는 방법 (내부 클래스)
	class Customer {
		int custId;
		String name;
		String adress;
		String phone;
	}
	
	Customer c1;

	public CustomerList() {
		// 객체
		c1 = new Customer();

		// 11g express edition은 orcl 대신 XE를 입력한다
		String url = "jdbc:oracle:thin:@localhost:1521:XE";

		String userid = "c##madang";
		String pwd = "c##madang";

		try { // 드라이버를 찾는 과정
			Class.forName("oracle.jdbc.driver.OracleDriver");
			System.out.println("드라이버 로드 성공");
		} catch (Exception e) {
		}

		try { // 데이터베이스를 연결하는 과정
			System.out.println("데이터베이스연결 준비...");
			con = DriverManager.getConnection(url, userid, pwd);
			System.out.println("데이터베이스연결 성공");
		} catch (Exception e) {
		}
	}

	// 객체를 쓰는 방법
	void getCustomer() throws Exception {
		String query = "SELECT custid, name, address, phone FROM customer"; // sql문
		Statement stmt = con.createStatement();
		ResultSet rs = stmt.executeQuery(query);
		System.out.println("custid, tname, address, phone");

		while (rs.next()) {
			c1.custId = rs.getInt(1);
			c1.name = rs.getString(2);
			c1.adress = rs.getString(3);
			c1.phone = rs.getString(4);
			
			printCustomer();

		}
		con.close();
	}

	void printCustomer() throws Exception {
		System.out.println(c1.custId + ", " + c1.name + ", " + c1.adress + ", " + c1.phone);
	}	
	
}

 

객체 배열을 사용하는 방법

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class CustomerList {
	Connection con;

	int index;
	
	// 객체 배열을 쓰는 방법
	class Customer {
		int custId;
		String name;
		String adress;
		String phone;
	}
	
	Customer cArr[];

	public CustomerList() {
		
		// 객체 배열
		cArr = new Customer[10];
		for (int i = 0; i < cArr.length; i++) {
			cArr[i] = new Customer();
		}

		// 11g express edition은 orcl 대신 XE를 입력한다
		String url = "jdbc:oracle:thin:@localhost:1521:XE";

		String userid = "c##madang";
		String pwd = "c##madang";

		try { // 드라이버를 찾는 과정
			Class.forName("oracle.jdbc.driver.OracleDriver");
			System.out.println("드라이버 로드 성공");
		} catch (Exception e) {
		}

		try { // 데이터베이스를 연결하는 과정
			System.out.println("데이터베이스연결 준비...");
			con = DriverManager.getConnection(url, userid, pwd);
			System.out.println("데이터베이스연결 성공");
		} catch (Exception e) {
		}
	}
	
	// 객체 배열을 쓰는 방법
	void getCustomer() throws Exception {
		String query = "SELECT custid, name, address, phone FROM customer"; // sql문
		Statement stmt = con.createStatement();
		ResultSet rs = stmt.executeQuery(query);
		
		index = 0;
		while (rs.next()) {
			cArr[index].custId = rs.getInt(1);
			cArr[index].name = rs.getString(2);
			cArr[index].adress = rs.getString(3);
			cArr[index].phone = rs.getString(4);
			
			index++;
		}
		con.close();
	}
	
	void printCustomer() throws Exception {
		System.out.println("custid, tname, address, phone");
		for (int i = 0; i < index; i++) {
			System.out.println(cArr[i].custId + ", " + cArr[i].name + ", " + cArr[i].adress + ", " + cArr[i].phone);
		}
	}
	
	
	
}

 

 

 

 

 

'Database > OracleSQL' 카테고리의 다른 글

데이터베이스 무결성  (0) 2020.04.27
데이터 베이스 모델링  (0) 2020.04.24
200409  (0) 2020.04.09
오라클 예제 및 문제  (0) 2020.04.08
200408  (0) 2020.04.08

------------------------------

클래스 구성
1. 멤버변수
2. 생성자 메서드
3. 일반 메서드
4. 내부 클래스

------------------------------

생성자의 역할

멤버변수에 대한 초기화

------------------------------

메서드의 역할

 

------------------------------

스태틱 메서드를 쓰는 이유

프로그램에서 공통적으로 사용하는 기능

공유를 위함

스태틱 멤버변수를 쓰기 위하여 사용

------------------------------

try catch를 쓰는 이유

에러에는 컴파일에러 / 런타임에러가  있다

컴파일 에러는 코드 작성시에 고칠 수 있지만
런타임 에러는 미리 예측하기가 어렵다

예측하기 어려운 런타임 에러를 대응하기 위해
try catch를 사용한다

엄밀하게는 if문 등을 이용해서 예외를 없도록 만드는 것이 좋으나
자바는 예외처리가 필요한 기능은 무조건 try catch를 써야한다

------------------------------

입력

1. System -> 자바에서 System 클래스는 Console OS를 말한다 (System.in)
2. 파일 입출력
3. 네트워크 입출력

------------------------------

ip 는 네트워크의 주소다 (랜카드 기준)

맥어드레스 - 랜카드의 고유한 번호

여러 아이피를 쓰려면 랜카드를 여러개 꽂으면 된다

------------------------------

드라이버

컴퓨터는 여러회사의 부품이 섞여있다.

그러므로 운영체제가 모든 하드웨어의 정보를 알 수 없다.
드라이버를 설치하면 운영체제가 하드웨어를 제어할 수 있게 된다.

자바에서도 마찬가지다.

자바에 오라클DB에 대한 드라이버를 설치하면
자바에서 오라클DB를 연동해서 사용할 수 있다. 

DB를 위한 자바클래스
1.Connection -> 연결
2.Statement -> 질의
3.ResultSet -> 응답 (결과 집합)

받아온 데이터를 String으로 변환

sql디벨로퍼의 폴더 안에 ojdbc.jar 를 찾는다

+ 자바 lib폴더에 넣고 빌드패스

 

'Programming Language > Java' 카테고리의 다른 글

자바 HashSet // TreeSet  (0) 2020.04.24
자바 StringTokenizer  (0) 2020.04.24
자바 그래프 만들기 (xml, json, gson, 공공데이터, SWING)  (0) 2020.04.22
자바 SWING 리스너  (0) 2020.04.22
20200421  (0) 2020.04.21

+ Recent posts