How to make the passwords encrypted in Tomcat server?
2 answers
java -cp encryptedDS.jar com.incorta.tools.tomcat.DataSourceFactory
Enter password:
Confirm password:
Encrypted Password: m1rwxCXxhW7p87U9AWe8yg==
Using the generated password in Tomcat
In Tomcat server.xml file, find the JDBC Datasource definition (i.e. Resource tag). Here's a sample datasource definition:
<Resource auth="Container" name="jdbc/incortaDB" type="javax.sql.DataSource"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" testOnBorrow="true"
initialSize="10" maxActive="500" minIdle="10" validationQuery="select 1"
driverClassName="com.mysql.jdbc.Driver" username="root" password="passw0rd"
To use the encrypted password, you need to do the following:
Add (or change if exists) the data source factory to com.incorta.tools.tomcat.DataSourceFactory. -
Update the password to be the encrypted one -from the previous step.-
Here's an update data source definition:
<Resource auth="Container" name="jdbc/incortaDB" type="javax.sql.DataSource"
factory="com.incorta.tools.tomcat.DataSourceFactory" testOnBorrow="true"
initialSize="10" maxActive="500" minIdle="10" validationQuery="select 1"
driverClassName="com.mysql.jdbc.Driver" username="root" password="m1rwxCXxhW7p87U9AWe8yg=="
Thanks & Regards
Nishant SDE