Javatpoint Logo

How we can encrupt password the password in hibernate.cfx.xml file

By: surajt*** On: Sun Nov 13 12:33:15 IST 2016     Question Reputation9 Answer Reputation0 Quiz Belt Series Points0  9Blank User
Hi Team,

I am trying to encrupt the password using jasypt with the following configuration.but it is not working. Can any one help me with the example

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>

<property name="connection.provider_class">
org.jasypt.hibernate4.connectionprovider.EncryptedPasswordDriverManagerConnectionProvider
</property>
<property name="connection.encryptor_registered_name">
configurationHibernateEncryptor
</property>

<property name="connection.url">jdbc:mysql://localhost/reportsdb</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.username">reportsUser</property>
<property name="connection.password">ENC(G6N718UuyPE5bHyWKyuLQSm02auQPUtm)</property>
<property name="connection.pool_size">12</property>

<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>

<!-- Mappings etc... -->

</session-factory>
</hibernate-configuration>
Up0Down