spring boot:如何为列值加密设置db2加密密码 [英] spring boot : how to set db2 encryption password for column value encryption

查看:84
本文介绍了spring boot:如何为列值加密设置db2加密密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当spring boot启动与我的db2的连接时,我想设置db2加密密码命令.基本上,我表中的某些列是加密的.我尝试了休眠映射器@ColumnTransformer(read ="decrypt_char(COLUMN_NAME,'password')",write ="encrypt(?,'password')").

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.

推荐答案

如果问题在于如何通过jdbc url传递加密密码特殊注册表变量设置,那么答案是:您需要在url中添加如下内容以下:

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';

用于JDBC和SQLJ 4类连接的IBM Data Server Driver的URL格式

这篇关于spring boot:如何为列值加密设置db2加密密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆