Posts

Showing posts with the label DB2

IBMi (AS400) fans only - How to store passwords in a secure way in a DB2 SQL Server database

Image
#IBMiSample This is a wery simple way to store passwords in a secure way in a DB2 SQL Server database. First of all create a table with only two fileds, user (UTENTE), and password (PWD). CREATE TABLE A01AWPWD (UTENTE varchar(128), PWD VARCHAR(124) FOR BIT DATA) Establish an encryption key. My encryption key for this example is skjdjuiu%Tr&$*+[be%_tr=\? Fill the table with users and passwords: INSERT INTO A01AWPWD (UTENTE, PWD) VALUES ('User01', ENCRYPT('Passw01', 'skjdjuiu%Tr&$*+[be%_tr=\?'))          INSERT INTO A01AWPWD (UTENTE, PWD) VALUES ('User02', ENCRYPT('Passw02', 'skjdjuiu%Tr&$*+[be%_tr=\?')) INSERT INTO A01AWPWD (UTENTE, PWD) VALUES ('JohnS', ENCRYPT('ert%9ii', 'skjdjuiu%Tr&$*+[be%_tr=\?')) Now we have a table A01AWPWD with ENCRYPTED passwords. Try this: SELECT PWD  FROM A01AWPWD  WHERE UTENTE = 'JohnS' As you can see, the password is ENCRYPTED. To read  (DECRYPT) the  passwords y

IBMi (AS400) fans only - Fully Free RPG: Procedure with a parameter and return value

Image
#IBMiSample AS5502.RPGLE - Procedure with a parameter and return value       **FREE          Ctl-Opt DFTACTGRP(*No);          Dcl-S gMyVar Char(13) Inz('<---Hello--->');          Dcl-S pValue2 Char(3);          Dcl-S pValue3 Char(3);          Dsply gMyVar;          pValue2='!__';          pValue3='__!';          gMyVar = MyProc('Goodbye':pValue2:pValue3);          Dsply gMyVar;          *InLR = *On;        Return;        Dcl-Proc MyProc;          Dcl-Pi *N Char(13); // Char(13) the length of returned                                   // parameter. It is like gMyVar Char(13)          pValue1 Char(7) Const;          pValue2 Char(

IBMi (AS400) fans only - QSQGNDDL API: How to get SQL SOURCE specification from a database object

Image
#IBMiSample QSQGNDDL API generates the SQL data definition language statements from a database object. Here's how to use it. How to get SQL CREATE TABLE specification from DDS