databaseoracle-databasejdbctomcat7ucp

How to encrypt oracle ucp database connection in tomcat config?


I want to encrypt my database connection in tomcat 7 config (server.xml). I'm using the connectionProperties to provide encryption algorithm, but somehow, these properties are not working.

Here is the chunk from my config file:

     <Resource
                  name="jdbc/TestDb" auth="Container"
                  type="oracle.ucp.jdbc.PoolDataSource"
                  description="UCP Pool in Tomcat"
                  factory="oracle.ucp.jdbc.PoolDataSourceImpl"
                  connectionFactoryClassName="oracle.jdbc.pool.OracleDataSource"
                  minPoolSize="10"
                  maxPoolSize="100"
                  inactiveConnectionTimeout="20"
                  user="******"
                  password="*****"  
                  connectionProperties="oracle.net.encryption_client=REQUIRED,
                                        oracle.net.encryption_types_client=AES256,
                                        oracle.net.crypto_checksum_client=REQUIRED,
                                        oracle.net.crypto_checksum_types_client=SHA512"
                  url="jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=***)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=***)))"
                  connectionPoolName="UCPPool"
                  sqlForValidateConnection="select 1 from DUAL"
                  validateConnectionOnBorrow="true" />

Tried with semicolon in connectionProperties in place of comma. But nothing is working.

Please see, if someone can help.


Solution

  • Try entering values in below format:

    {prop1=val1, prop2=val2, ..., propN=valN}
    

    All key value pairs should be separated by , (comma and space char) and should be placed within {}.

    For example in your case, it should be:

    connectionProperties="{oracle.net.encryption_client=REQUIRED,                                        oracle.net.encryption_types_client=AES256,                                         oracle.net.crypto_checksum_client=REQUIRED,                                       oracle.net.crypto_checksum_types_client=SHA512}"