반응형
import java.sql.*;
import java.util.*;
public class RunProc {
public static void main(String arg[]) {
Common.loadDrover();
Connection con = null;
CallableStatement cstmt = null;
try {
con = DriverManager.getConnection(
"jdbc::oracle:thin:@127.0.0.1:1521:orcl", "사용자아이디",
"사용자 패스워드");
System.out.print("저장할 메시지: ");
Scanner sc = new Scanner(System.in);
String msg = sc.nextLine();
sc.close();
cstmt = con.prepareCall("{call myproc(?)}");
cstmt.setString(1, msg);
cstmt.executeQuery();
} catch (Exception e) {
System.out.println(e.getMessage());
} finally {
try {
if (cstmt != null)
cstmt.close();
if (con != null)
con.close();
}
catch (Exception e) {
}
}
}
}
'JAVA > Java' 카테고리의 다른 글
| [JAVA] Mysql DB 접속하기(Connect) (0) | 2014.11.18 |
|---|---|
| [JAVA] Oracle DB 접속 후 Insert,select 하기 (0) | 2014.11.18 |
| [JAVA] xml 파싱(Parsing) 하기 (0) | 2014.11.18 |
| [JAVA] 간단한 UDP server, client (0) | 2014.11.18 |
| [JAVA] Thread 를 사용하여 URL 웹 파일 다운로드 (0) | 2014.11.18 |