I'm trying to write my first FIELDPROC POC and I've not had the greatest success...
I created a table:
CREATE TABLE TESTFILE
(NORMALFIELD FOR COLUMN NORFLD CHAR (10 ) NOT NULL WITH DEFAULT,
FIELDWITHPROC FOR COLUMN FLDPRC CHAR (10 )
FIELDPROC library/TESTFLDPR2 NOT NULL WITH DEFAULT)
So now I've registered TESTFLDPR2 as the program to run when values are written/read from the table.
I stole Kent Milligan's code from an article he wrote. Here is the link to the article and code: http://www.mcpressonline.com/database/db2/enable-transparent-encryption-with-db2-field-procedures.html#sthash.BA9pIdAt.dpuf
Before creating the table, I put TESTFLDPR2 in debug. When I ran the CREATE, I watched the registration occur and then it went through the encode portion of the code. All seems good.
Then I INSERTED a row into the table, debug is still active, and there is no indication that the code was run...the debugger didn't show me the steps.
INSERT INTO TESTFILE VALUES('2345678901', 'abcdefgh23')
I looked at the data using a simple SELECT and the data was as I inserted it...presumably due to being decoded...but again...the debugger didn't show me.
SELECT * FROM TESTFILE
So I DROPped the FIELDPROC:
ALTER TABLE TESTFILE ALTER COLUMN FIELDWITHPROC DROP FIELDPROC
I reran the SELECT and expected to see encoded data, but got the same results as before.
To me, it seems that the data was never encoded in the first place and I can't understand why the FIELDPROC wasn't invoked on the INSERT of my test data.
Have I missed something? Done something wrong?
This communication, including attachments, is confidential, may be subject to legal privileges, and is intended for the sole use of the addressee. Any use, duplication, disclosure or dissemination of this communication, other than by the addressee, is prohibited. If you have received this communication in error, please notify the sender immediately and delete or destroy this communication and all copies.