Enterprise Edition Home | Express Edition Home | Previous Page | Next Page   SQL Statements > SET ENCRYPTION PASSWORD >

Specifying a Session Password and Hint

The required password specification can be quoted strings or other character expression that evaluates to a string whose length is at least 6 bytes but no more than 128 bytes. The optional hint can specify a string no longer than 32 bytes.

The password or hint can be a single word or several words. The hint should be a word or phrase that helps you to remember the password, but does not include the password. You can subsequently execute the built-in GETHINT function (with an encrypted value as its argument) to return the plain text of hint.

The following ESQL/C program fragment defines a routine that includes the SET ENCRYPTION PASSWORD statement and executes DML statements:

process_ssn( )
{
EXEC SQL BEGIN DECLARE SECTION;
char password[128];
char myhint[33];
char myid[16], myssn[16];
EXEC SQL END DECLARE SECTION;
. . . 
EXEC SQL SET ENCRYPTION PASSWORD :password WITH HINT :myhint;
...
EXEC SQL INSERT INTO tab1 VALUES (':abcd', ENCRYPT_AES("111-22-3333")) ;
EXEC SQL SELECT Pid, DECRYPT(ssn, :password) INTO :myid, :myssn;
...
EXEC SQL SELECT GETHINT(ssn) INTO :myhint, WHERE id = :myid;
}
Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]