设为首页 加入收藏

TOP

ORACLE创建Java过程
2015-11-21 01:48:30 来源: 作者: 【 】 浏览:1
Tags:ORACLE 创建 Java 过程
??

STEP1:

CREATE OR REPLACE JAVA SOURCE NAMED "Employee" AS
?

import java.sql.*;
import oracle.jdbc.*;

public class Employee{

public static void getItEmps(){
Connection conn = null;
PreparedStatement pst = null;
ResultSet rs = null;
try{
conn = DriverManager.getConnection("jdbc:default:connection:");
String sql = "select * from sys.employee where e_id > 1000";
pst = conn.prepareStatement(sql);
rs = pst.executeQuery();
while(rs.next()){
System.out.println(rs.getString(1) + "\t" + rs.getString(2));
}
}catch(Exception e){
System.err.println(e);
}finally{
try{
rs.close();
pst.close();
conn.close();
}catch(Exception e){
System.err.println(e);
}
}
}
}

STEP2:

create or replace procedure get_it_emps AS LANGUAGE JAVA NAME 'Employee.getItEmps()';

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Oracle统计数据库表的个数和名字 下一篇oracle连接类型

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: