Hello again.
      Thanks everyone for the suggestion.  it works. I do have one quick
question----does any one have a pice of code that I can use or take a
look at or use as an example.  I need to encrypt user password before
inserting them into the database.  see code snipet below.

Cheers

Pat


public boolean validateUser(String username, String userpassword)
 {
         String dbuserid = "";
         String dbpasswd = "";
         boolean isValidUser = false;
         try
            {
                Class.forName("oracle.jdbc.driver.OracleDriver");
            }
                catch(java.lang.ClassNotFoundException e)
                {
                  System.err.print("ClassNotFoundException:");
                  System.err.println(e.getMessage());
       }

         try
           {
           //DriverManager.registerDriver(new
oracle.jdbc.driver.OracleDriver());
           Connection conn = DriverManager.getConnection(
           "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS="+
           "(PROTOCOL = TCP)(HOST = fred)"+
           "(PORT = 1521)))(CONNECT_DATA = (SID =ORA)))",
           "dev_user","dev_user");

           // Create a Statement and create a query string!
             String query = "SELECT  USERNAME, PASSWORD FROM USERLOGIN"
+
                            " where USERNAME = '" + username +
                            "' and PASSWORD = '" + userpassword + "'";
                  Statement stmt = conn.createStatement();
                  ResultSet rst = stmt.executeQuery(query);

               if (rst.next()) {
               dbuserid = rst.getString(1);
               dbpasswd = rst.getString(2);
             }
             if ( username.equals(dbuserid.trim()) &&
userpassword.equals(dbpasswd.trim()) )
             {
                 //We have a successful match of input userid and
                 //password with a database rec.
                 isValidUser = true;
                } else {
                        //we did not succeed
                        isValidUser = false;
                }

            stmt.close();
            conn.close();
           } catch(SQLException ex) {
                System.out.println("SQLException: " + ex.getMessage());
           }
           return isValidUser;
          }
        }

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to