String pwd = "ibmdb2";
con = DriverManager.getConnection(url, uid, pwd);
} catch (SQLException e) {
e.printStackTrace();
}
}
protected boolean passwordsMatch(String username, String password) {
boolean match = false;
try {
// verify username+password
String sqlStmt = "select password from userverify where username=" + " " +
username + " ";
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(sqlStmt);
if (rs.next()) {
ResultSetMetaData rsmd = rs.getMetaData();
if (rsmd.getColumnCount() > 0) {
// implement any password algorithm here for checking
String thePassword = rs.getString(1);
if (thePassword.equals(password)) {
match = true;
}
}
}
} catch (SQLException e) {
e.printStackTrace();
}
return match;
}
protected void raiseError(String errorText, String errorPage, HttpServiceRequest req,
HttpServiceResponse res) {
try {
HttpSession session = req.getSession(true);
session.putValue("error", errorText);
res.callPage(errorPage, req);
} catch (Exception e) {
e.printStackTrace();
}
}
private String toString(Hashtable errors) {
Enumeration he = errors.keys();
String errorText = "";
String fieldName = "";
while (he.hasMoreElements()) {
fieldName = (String) he.nextElement();
errorText = errorText + errors.get(fieldName) + "

";

}
return errorText;
}
private void uidPwdError(String username, String password, String redirectedPage,
HttpServiceRequest req, HttpServiceResponse res) {
HttpSession session=req.getSession(true);
raiseError("Username \"" + username + "\" with password \"" + password + "\" invalid",
redirectedPage, req, res);
}
private void usernameError(String username, String redirectedPage, HttpServiceRequest
req, HttpServiceResponse res) {
raiseError("Username \"" + username + "\" does not exist", redirectedPage, req, res);
}
protected boolean usernameExists(String username) {
boolean exists = false;
try {
if (username == null) {
156
Linux Web Hosting with WebSphere, DB2, and Domino




  

Home

About Services Network Support FAQ Order Contact
 

Linux Web Hosting

Our partners:Jsp Web Hosting Unlimited Web Hosting Cheapest Web Hosting  Java Web Hosting Web Templates Best Web Templates PHP Mysql Web Hosting Interland Web Hosting Cheap Web Hosting PHP Web Hosting Tomcat Web Hosting Quality Web Hosting Best Web Hosting  Mac Web Hosting 

Lunarwebhost.net  Business web hosting division of Vision Web Hosting Inc. All rights reserved