public class DAO { //1. 오라클 id, password, 접속 URL을 각각 String 변수로 만듦 String id = "sys as SYSDBA"; String pass = "1234"; //thin : 드라이버 localhost : 본인의 데이터베이스가 설치된 서버 1521 : 포트 번호 XE : 식별자 String url = "jdbc:oracle:thin:@localhost:1521:XE"; //2. db에 접근할 수 있도록 Connection 객체 생성 Connection con; //db에 접근할 수 있도록 설정 //db에 접근할 수 있도록 도와주는 메소드 public void getCon() { try { //1.해당 데이터베이스를 사용한다고 선언(클래스 등록. - 오라클) Class.forName("oracle.jdbc.driver.OracleDriver"); //2.해당 데이터베이스에 접속 con = DriverManager.getConnection(url,id,pass); System.out.println("Connection 객체생성"); }catch (Exception e) { e.printStackTrace(); } } //getCon end } //DAO end