问题
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.
回答1:
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
来源:https://stackoverflow.com/questions/53126455/spring-boot-how-to-set-db2-encryption-password-for-column-value-encryption