File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes How to encrypt the datasource password Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Reply Bookmark "How to encrypt the datasource password" Watch "How to encrypt the datasource password" New topic
Author

How to encrypt the datasource password

Juanjo Bazan
Ranch Hand

Joined: Feb 04, 2002
Posts: 231
I had configured a JNDI DataSource in Tomcat adding a context in the server.xml file.
Since we are sharing the Tomcat server with developers from other company (who also have access to the configuration files) I would like to avoid to declare the user/password pair in plain text like this:

Is possible to store the value of the DB password encrypted when creating a JNDI Datasource?
Thank you
Lu Battist
Ranch Hand

Joined: Feb 17, 2003
Posts: 104
Sure its possible. Look up JCE. You would store the encrypted password in the xml file. Then decrypt it in the servlet that makes the database connect. You may also have to store a key in that servlet as well. It may not be fool-proof but would prevent causual id theft.
 
IntelliJ Java IDE
 
subject: How to encrypt the datasource password
 
Threads others viewed
DBCP could not obtain an idle db connection
problem with connection pooling
Oracle 9i on Tomcat5 JNDI configuration
Hibernate not finding Oracle driver - despite straight JDBC working
JNDI Connection with Oracle (Problem with NullPointerException)
developer file tools