6 Replies Latest reply on Jul 19, 2013 2:11 AM by user8757340

    How to create a variable within <sql:setDataSource> for database password


      Hi there,


      I hope someone can enlighten me on this.


      I'm trying to create a jsp page which uses JSTL to access the database. Regulation in my company requires me to use encrypted database password.


      Below is the snippet of my codes. The error I receive is the password="${decryptedPassword}" never work. However, it could print out the password correctly using "System.out.println("Password is "+decryptedPassword);" How should I pass the variable "decryptedPassword" into the password??


      Thanks alot!



              //System.setProperty("oracle.net.tns_admin", "C:/NEW PC BACKUP/oracle/product/10.2.0/client_1/NETWORK/ADMIN");
              System.setProperty("oracle.net.tns_admin", "/usr/local/oracle/");
              String decryptedPassword = "";

              //logger.info("PLANNER_REPORT_EDOW_PSWD_ENCRYPT_KEY=<"+ keyAlias+">");

              FileBasedKeyStore fStore = new FileBasedKeyStore("/usr/local/scripts/keystorefile/key.dat", null);
              if (fStore == null) System.out.println("KeyStore is null");
              Key key = (Key) fStore.getKey("citos");
              if (key == null) System.out.println("key is null");
              decryptedPassword = new String(CryptoUtil.decryptFromBase64("Oci/n5asIP6CDR01WwvXtw==", key));
              System.out.println("Password is "+decryptedPassword);


              <sql:setDataSource var="snapshot" driver="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@cngd" user="citosapp"  password="${decryptedPassword}"/>