Home > Back-end >  Java to JDBC. The properties file of the database account password is encrypted, can not be normal q
Java to JDBC. The properties file of the database account password is encrypted, can not be normal q

Time:11-29

Question:
Java SSM to JDBC. The properties file of the database account password is encrypted, now the problem is not encrypted, can normal connection query; Encryption can be normal after startup connection, but will not be able to query a query, encrypted password is not decrypted,
Error message:
org. Mybatis. Spring. MyBatisSystemException: nested exception is org. Apache. Ibatis. Exceptions. PersistenceException:
# # # Error querying the database. Cause: org. Springframework. JDBC. CannotGetJdbcConnectionException: Could not get JDBC Connection; Nested exception is org.apache.com mons. DBCP. SQLNestedException: always load the JDBC driver class '3 wir5v + MgYH2IqEC1j4hDUggrXgXVC2r/Ah4Tm5aqZQ=. Encryption'
# # # The error may exist in The file [D: \ Java \ apache tomcat - 7.0.90 \ webapps \ DataLink \ WEB - INF \ classes \ com \ aa \ api2 \ mapper \ CustomerMapper_yh XML]
# # # The error may involve com. Aa. The api2. Dao. ICustomerDao2. GetAllCustomer
# # # The error occurred while executing a query
# # # Cause: org. Springframework. JDBC. CannotGetJdbcConnectionException: Could not get JDBC Connection; Nested exception is org.apache.com mons. DBCP. SQLNestedException: always load the JDBC driver class '3 wir5v + MgYH2IqEC1j4hDUggrXgXVC2r/Ah4Tm5aqZQ=. Encryption'



below is the project information:
1, JDBC properties file :
# data source 2
JDBC. Driver2=3 wir5v + MgYH2IqEC1j4hDUggrXgXVC2r/Ah4Tm5aqZQ=encryption
JDBC. Url2=JJjXfBGoZqt26mFQLlvLGROAOFUUkeoNTZmekjWDYbtXSDJxdBVSnvOJ0wPaX/DK. Encryption
JDBC. Username2=dGN8ovU9LpfA0omlTZ1img==. Encryption
JDBC. Password2=/5 KB + M7G3ivarVFSVn6SYg==. The encryption

2, the applicationContext. XML configuration information:





The classpath: JDBC. Properties






P: mapperLocations="classpath: com/aa/api2/mapper/*. XML"/& gt;

P: basePackage="cn. Aa. API. Mapper" p: sqlSessionFactoryBeanName="sqlSessionFactory2"/& gt;

P: the dataSource - ref="dataSource2"/& gt;
Can specify multiple packages, bags and bags are separated by a comma or semicolon - & gt;


3, EncrypPropertyPlaceholderConfigurer. Java file:
Public class EncrypPropertyPlaceholderConfigurer extends accomplished {

@ Override
Protected void processProperties (ConfigurableListableBeanFactory beanFactoryToProcess,
The Properties props) throws BeansException {
/* * 2 */data source
String driver2=props. GetProperty (" JDBC. Driver2 ");
Driver2=driver2. Substring (0, driver2. Length () - 11);
If (driver2!=null) {//will be encrypted driver2 decrypted into props
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related