oracle procedure 通过接口url发短信
oracle procedure 不能直接open url地址,只能通过调用java procedure ,java procedure 再open url这样绕下
first
create or replace and compile java source named sms_send as import java.io.*; import java.net.*; import java.lang.*; import oracle.sql.*; public class sms_send extends Object { public static void send_msg(String mno, String mcont,int mw) { try { String data = "ps_msend_user" + "=" + mno; //mobile no data += "&" + "ps_msend_cont" + "=" + mcont; //comment data += "&" + "ps_msend_weight" + "=" + mw; //weight // Send data URL url = new URL(); URLConnection conn = url.openConnection(); conn.setDoOutput(true); // conn.setRequestMethod("POST"); OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream()); wr.write(data); wr.flush(); wr.close(); } catch (Exception e) { } } }
|
create oracle procedure
create or replace procedure sms_send( mno in varchar2, mcont in varchar2, mw in number ) as language java name 'sms_send.send_msg(java.lang.String, java.lang.String,int)';
|
---------------------------于20090818添加---------------------------------------
后来查看oracle文档,发现10G已经有了dbms的包去做这事了,唉,绕了一圈有回来了
具体查看dbms_http
---------------------------于2010-03-30添加---------------------------------------
SELECT HTTPURITYPE.createuri ('').getClob() web_page FROM DUAL ;
原来就这么简单
阅读(3430) | 评论(0) | 转发(0) |