Password Encryption

I got a problem that I am creating a Connection Pool by using JNDI Datasource and I am using Resign 2.0.5 as web server and my Java ver 1.4.0. For this we are specifing the database username and password in resin.conf file as following:

<resource-ref>
<res-ref-name>jdbc/test</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<init-param driver-name="oracle.jdbc.driver.OracleDriver"/>
<init-param url="jdbc:oracle:thin:@192.168.168.4:1550:gbs27"/>
<init-param user="rnd"/>
<init-param password="rnd"/>
</resource-ref>

In java file we are given as follows :

Context ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/test");
Connection dbCon = ds.getConnection(sUserId,sPassword);

My problem is if we specify username and password in resin.conf file then whenever user login then its creating a new connection without getting the new connection from Connection pool. If we didn't speicfy the username and password in the resin.conf then its getting the new connection from Connection pool.

I don't want to specify the username and password directly in the resin.conf. Password should be in the form of encryption. How can I encrypt the password and put in resin.conf and wheather resin.conf indentifies the encrypted password or not? Is there any specail tags? Please give suggests for my problem.



Attachment(s):
GBMDBPool.java
GBMDBCommonComponent.java
GBMDBConnectionComp.java
resin.conf
connection.properties
1 comment

This is the wrong forum for this. You should find a resin forum.

Srinivasa Rao Jami wrote:

I got a problem that I am creating a Connection Pool by using JNDI Datasource and I am using Resign 2.0.5 as web server and my Java ver 1.4.0. For this we are specifing the database username and password in resin.conf file as following:

<resource-ref>
<res-ref-name>jdbc/test</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<init-param driver-name="oracle.jdbc.driver.OracleDriver"/>
<init-param url="jdbc:oracle:thin:@192.168.168.4:1550:gbs27"/>
<init-param user="rnd"/>
<init-param password="rnd"/>
</resource-ref>

In java file we are given as follows :

Context ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/test");
Connection dbCon = ds.getConnection(sUserId,sPassword);

My problem is if we specify username and password in resin.conf file then whenever user login then its creating a new connection without getting the new connection from Connection pool. If we didn't speicfy the username and password in the resin.conf then its getting the new connection from Connection pool.

I don't want to specify the username and password directly in the resin.conf. Password should be in the form of encryption. How can I encrypt the password and put in resin.conf and wheather resin.conf indentifies the encrypted password or not? Is there any specail tags? Please give suggests for my problem.

0

Please sign in to leave a comment.