-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJava241_plsql.java
More file actions
60 lines (51 loc) · 1.26 KB
/
Copy pathJava241_plsql.java
File metadata and controls
60 lines (51 loc) · 1.26 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package java1031_plsql;
/*
SQL> begin
proc06_othermode('정소라', '대전');
end;
/
*/
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class Java241_plsql {
private Connection conn;
private CallableStatement cstmt;
public Java241_plsql() {
process();
}
private void process() {
try {
Class.forName("oracle.jdbc.OracleDriver");
String url = "jdbc:oracle:thin://@127.0.0.1:1521:xe";
String user = "hr";
String password = "a1234";
conn = DriverManager.getConnection(url, user, password);
// String sql = "{call proc06_othermode(?, ?)}";
// cstmt = conn.prepareCall(sql);
// cstmt.setString(1, "정소라");
// cstmt.setString(2, "대전");
String sql = "{call proc06_othermode(?, ?)}";
cstmt = conn.prepareCall(sql);
cstmt.setString(1, "차두리");
cstmt.setString(2, "포항");
cstmt.execute();
System.out.println("program end");
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
cstmt.close();
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
public static void main(String[] args) {
new Java241_plsql();
}
}