How to configure Database password encryption Access database __ Database

Source: Internet
Author: User
Tags base64

In the general database configuration file, the connection database is like this, and now the project needs to encrypt the password processing,

So we're going to rewrite the Org.apache.commons.dbcp.BasicDataSource class as follows:

Package com.joyintech.tisaccel.base;

Import Org.apache.commons.dbcp.BasicDataSource;

public class Teradataconnection extends Basicdatasource {

Public Teradataconnection () {
TODO auto-generated Constructor stub
Super ();
}

@Override
public void SetPassword (String password) {
try{
This.password = base64.decryptdata (password);
}catch (Exception e) {

}
}
}

We rewrote the SetPassword method of the class, using Base64.decryptdata (password) when assigning values to password, and decrypting the password, the encryption algorithm used here is

[Java]java Encryption decryption algorithm (based on org.apache.commons) source code details please see http://www.cuplayer.com/player/PlayerCodeAs/2015/01141756.html "turn"


After rewriting SetPassword, we can modify the database configuration as follows:


So we can access the database directly with ciphertext,


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.