Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2004
    Location
    Egypt
    Posts
    61

    Unanswered: DB2 encrypted column

    hi,

    i want to make an encrypted column to store phone numbers, does DB2 support this
    and how can i do that if possible

    thanks
    hany heggy,
    IBM certified Professional, AIX system support
    www.melodyhits.tv

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    Yes, you can ...

    You'll have to define the column as CHAR FOR BIT DATA


    Search for ENCRYPT and DECRYPT in the documentaiotn

    Cheers
    Sathyaram
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  3. #3
    Join Date
    Jan 2004
    Location
    Egypt
    Posts
    61
    thanks for yr help and here is the code


    connect to sample ;

    drop table t1 ;

    create table t1 (
    c1 varchar(29) for bit data ,
    c2 varchar(29) for bit data ,
    nickname varchar(30)
    ) ;


    insert into t1 values ( encrypt('0101717561','hany12','name') , encrypt('0101717501','hany12','name') ,'aix1') ;
    insert into t1 values ( encrypt('0101717562','hany12','name') , encrypt('0101717502','hany12','name') ,'aix2') ;
    insert into t1 values ( encrypt('0101717563','hany12','name') , encrypt('0101717563','hany12','name') ,'hany heggy') ;
    insert into t1 values ( encrypt('0101717564','hany12','name') , encrypt('0101717504','hany12','name') ,'aix4') ;


    select * from t1 ;

    select decrypt_char(c1,'hany12'), decrypt_char(c2,'hany12') from t1 where decrypt_char (c1,'hany12') = '0101717561' ;

    select decrypt_char(c1,'hany12'), decrypt_char(c2,'hany12') from t1 where decrypt_char (c2,'hany12') = '0101717502' ;

    select decrypt_char(c1,'hany12'), decrypt_char(c2,'hany12') , nickname from t1 where c1 = c2 ;

    select * from t1 where c1 = c2 ;
    hany heggy,
    IBM certified Professional, AIX system support
    www.melodyhits.tv

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •