This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes JDBC and the fly likes Decryption technique is not working in the JSP page Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Reply locked New topic
Author

Decryption technique is not working in the JSP page

rajkumar jayavel
Greenhorn

Joined: Aug 09, 2011
Posts: 13
DataSource ds = null;
Connection con = null;
InitialContext ic;
PreparedStatement pr = null;
ResultSet rs = null;
String user = "";
String pass = "";
String sQuery = "SELECT PASSWORD,USERNAME FROM PDBUSER (NOLOCK) WHERE userindex='1'";
out.println("BFORE initiating the connection");
try {
ic = new InitialContext();
System.out.println("sql Query:"+sQuery);
out.println("sql Query:"+sQuery);
ds = (DataSource) ic.lookup("java:/daiichi_prd");
con = ds.getConnection();
pr = con.prepareStatement(sQuery);
rs = pr.executeQuery();
JTSSecurity objJTSSecurity = null;
while (rs.next()) {
System.out.println("initiating the connection");
out.println("initiating the connection");
byte passwordbyte[] = rs.getBytes(1);
out.println("passwordbyte:"+passwordbyte);

String passwordstr = new String(passwordbyte);
out.println("passwordstr"+passwordstr);
byte aabyte0[] = passwordstr.getBytes("ISO8859_1");
objJTSSecurity = new JTSSecurity();
byte value1[] = objJTSSecurity.decode(aabyte0);
pass = new String(value1);
user = rs.getString(2);

}
rs.close();
pr.close();
con.close();
System.out.println("Test Print ln pwd:" + pass);
System.out.println("Test Print ln user" + user);
out.println("Test Print ln pwd:" + pass);
out.println("Test Print ln user" + user);
} catch (Exception e) {
out.println("Exception in connect cabinet..-->" + e.getMessage());
}


Following code could decrypt the password working fine in the stand alone java program,
whenver i added in the JSP tag its not working for me.
Please help me
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 8210
    
  71

I've moved this to the JDBC forum since Ranch Office isn't the place to discuss this. Although you say it's got to do with JSP, looking at the code, I don't think the problem lies in anything related to JSP. JDBC looks like an appropriate forum for this, right now. By the way, you'll have to add more details on what you mean by "not working".

[My Blog] [JavaRanch Journal]
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19232

Please UseOneThreadPerQuestion. Since you have some more information in your other thread and the problem seems to only occur in JSP pages, I'll close this thread.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Decryption technique is not working in the JSP page
 
Similar Threads
MySQL Datasource
StaleConnectionException
Exception thrown org.jboss.util.NestedSQLException
else loop not working
Name Not Bound Exception