1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class JDBCProject {
public static void main(String[] args) {
Connection conn = null;
//Statement stmt = null;
String url ="jdbc:oracle:thin:@localhost:1521:xe";
String id = "common";
String pw = "common";
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection(url, id, pw);
//stmt = conn.createStatement();
System.out.println("DB 연결 성");
conn.close();
//stmt.close();
}catch(ClassNotFoundException e) {
System.out.println("연결 실");
}catch(SQLException e) {
e.printStackTrace();
}
}
}
|
cs |
세부 설명은
밑에 링크 참조
https://pearl23.tistory.com/65
'Programming | Study > JDBC' 카테고리의 다른 글
JDBC 구조 (0) | 2021.10.11 |
---|---|
JDBC 개요 (0) | 2021.08.29 |
댓글