那么有没有什么简单点的办法呢?请往下看: # y8 ? i Z" k+ r
模型:oracle7.3;开发工具:develope2000。收费系统(在数据库中的名称是sfyy),其client端分散在市区的数个营业点,通过城域网与主机(小型机)相连。
' g' g& J: z3 [过程: 5 N/ W& X1 V4 ^" H5 M( s
·在收费小型机oracle系统的system用户(dba)下,创建新用户test; 5 B% ~) e% Y$ Q" W( n
3 \9 \% c y) |; N$ c7 l5 v% |
create user testidentified by cartondefault tablespace dataspace1quota 100k
2 a# @( x* j, m/ d·对test用户授以权限; . ~* q( X; S: o% B2 x
/ L' F& R* x1 ~# e3 a& ~
grant create session to test;grant resource to test;
* y4 |, h+ @1 u9 C+ C4 V5 m0 x·在test用户下建立一个存储函数mmtranslate,它其实是一个加密程序。下面是一个简单的例子。
0 q" s5 R# n; G% x
, l& M. e' P) c$ _7 a% Wfunction mmtranslate(m varchar2)return varchar2asi number(2);kk varchar2(10);beginkk:=′′;i:=1;loopif i0 thenkk:=kk||chr(100+to_number(substr(m,i,1)));elseif instr(‘wxyz‘,substr(m,i,1),1,1)>0 thenkk:=kk||chr(-8+ascii(substr(m,i,1)));elsekk:=kk||chr(4+ascii(substr(m,i,1)));end if;elseexit;end if;i:=i+1;end loop;return kk;exceptionwhen others thenreturn ′-1′;end;5 ~/ J/ e8 Y4 `3 l. `3 }8 I- |# U2 V
·在test用户下建表mmtest并插入记录:
) }) \0 i b( N; V6 F5 h
; i* N4 P% w4 @( n! h$ g! fcreate table mmtest(usnamevarchar2(6),------用户名称mimavarchar2(6)------加密前的密码);insert into mmtest values( ‘sfyy‘,‘eds2‘);commit;
7 w8 F7 \0 q; {+ j! g1 J2 n4 t·执行以下语句
. [1 p7 |# N/ d0 P( Y
3 g# s1 ^( ^, i) a b" Csql>select mmtranslate(‘eds2‘) from dual;mmtranslate(‘eds2‘)----------------------------------------ihwf
8 ?) z' u$ F) s/ c; F& |) q$ B利用dba权限更改sfyy的密码为上面语句的执行结果:
! C5 \5 J' j6 n6 |4 P8 r
0 ]' [( C9 q! p- ^: Y( Walter user sffyidentified by ihwf; ;! L* F7 W w o0 p( _8 z& y o; w9 |
·修改应用程序,对于开发环境是develope2000的程序来说,主要是修改主程序的on-lo gon触发器: ! \4 S: U# K0 j" K6 L9 _# J
" J9 B3 Z" ^$ {
declaremm varchar2(6);beginlogon(‘test‘,‘carton‘);select mima into mm from mmtest where usname=‘sfyy‘;mm:=mmtranslate(mm);logout;logon(‘sfyy‘,mm);end; |