Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1985557
  • 博文数量: 148
  • 博客积分: 7697
  • 博客等级: 少将
  • 技术积分: 3071
  • 用 户 组: 普通用户
  • 注册时间: 2006-03-10 23:04
个人简介

MiBDP,数据开发、项目团队、数据应用和产品在路上,金融保险、互联网网游、电商、新零售行业、大数据和AI在路上。对数仓、模型、ETL、数据产品应用了解。DTCC 2013演讲嘉宾,曾做过两款大获好评的数据产品平台。知识星球ID:35863277

文章分类
文章存档

2020年(1)

2019年(2)

2017年(2)

2016年(5)

2015年(1)

2014年(1)

2013年(6)

2012年(5)

2011年(24)

2010年(28)

2009年(1)

2008年(6)

2007年(30)

2006年(36)

分类: Oracle

2010-11-08 19:05:21

    oracle在使用utl_http包读取某个url连接的内容时,对于http协议与https协议的url两者的处理是截然不同的,上两篇文章已经有使用http的啦,而https是加密的协议,所以需要用到oracle的wallet manager管理模块,wallet顾名思义就是钱包钱袋的管理,说白了就是安全管理(钱包、钱袋)吗^_^
  下面我们就简单学习下oracle wallet manager(针对utl_http包的使用)
首先要使用utl_http包抓取htttps上的内容,需要UTL_HTTP.SET_WALLET (
path IN VARCHAR2,
password IN VARCHAR2 DEFAULT NULL);
那么在设置wallet前我们的步骤是:
第一.创建wallet目录
[oracle@localhost wallet]$ mkdir wallet
第二.新建wallet
[oracle@localhost wallet]$ orapki wallet create -wallet /home/oracle/wallet -pwd wallet
第三.导入受信任的https安全证书
[oracle@localhost wallet]$ orapki wallet add -wallet /home/oracle/wallet -trusted_cert -cert /home/oracle/wallet/CA_cert.cer

到此针对utl_http包获取https网页内容的配置就可以了


不过对于oracle的utl_http包处理https数据还是不是很灵活,会遇到不同的问题!

create or replace procedure get_realtime_account_data is
  req UTL_HTTP.REQ;
  resp UTL_HTTP.RESP;
  val varchar2(2000);
  real_records datacenter.common_utils.STRING_LIST;
  fields datacenter.common_utils.STRING_LIST;
  d_date date := to_date(to_char(sysdate, 'yyyy-mm-dd hh24:mi') ||
                               ':00',
                               'yyyy-mm-dd hh24:mi:ss');
begin
  UTL_HTTP.SET_WALLET('file:/home/oracle/wallet', 'wallet');
  req := UTL_HTTP.BEGIN_REQUEST('');
  resp := UTL_HTTP.GET_RESPONSE(req);
  utl_http.read_line(resp, val, true);
  utl_http.end_response(resp);
  real_records := datacenter.common_utils.EXPLODE(val, '|');

  for i in 1 .. real_records.count loop
    fields := datacenter.common_utils.EXPLODE(real_records(i), '/');
    insert into stat_realtime_player_count
    values
      (d_date, fields(1), '', fields(2));
  end loop;
  commit;
EXCEPTION
  WHEN utl_http.end_of_body THEN
    utl_http.end_response(resp);
end get_realtime_account_data;


阅读(4682) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2010-11-09 16:35:49

很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com