Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
321 views
in Technique[技术] by (71.8m points)

java - spring boot : how to set db2 encryption password for column value encryption

I want to set db2 encryption password command when spring boot starts a connection with my db2. Basically some of the columns in my table are encrypted. I tried hibernate mapper @ColumnTransformer(read="decrypt_char(COLUMN_NAME,'password')",write="encrypt(?,'password')").

That does not work. After some look around I found that I have to set the encryption password with the following command when the database connection is established from spring boot application properties file.

     SET ENCRYPTION PASSWORD ='password'(This is DB2 specific)

I dont see any way of setting this in spring boot. I believe there must be a property defined in application.properties which would set this. Currently I am just passing db2 connection as per following

spring.datasource.url=url
spring.datasource.username=username
spring.datasource.password=password
spring.datasource.driver-class-name=om.ibm.db2.jcc.DB2Driver

Any help is appreciated.
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

If the question is on how to pass the encryption password special registry variable setting via jdbc url, then the answer is: you need to add to the url something like the following:

...;specialRegisters=ENCRYPTION PASSWORD='password';

URL format for IBM Data Server Driver for JDBC and SQLJ type 4 connectivity


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...