Advertisement

03.17.2005 at 08:25PM PST, ID: 21355544
[x]
Attachment Details

RMI return value

Asked by _Esam in Java Programming Language

Tags: return, rmi, value

Hi,
I was trying to use the user entered id and password from a logon method and verify if they exist.

It seems that the program is returning false even if the user exists in the database.
There must be some logical error with my Implementation method..
Could you please check what the error could be.
>>>
If the user exists, I would like return true, if not then false.
Here is the method that returns the boolen value:

public boolean verify(int ID, String password){
            try{
                  Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
                  connection = DriverManager.getConnection(
                  url, username, password );
                  String sql = "SELECT UST_ID, PASSWORD FROM STUDENT WHERE UST_ID = ? and PASSWORD = ?";
                  PreparedStatement ps = connection.prepareStatement(sql);
                  ps.setInt(1, ID);
                  ps.setString(2, "password");
                  ps.executeQuery();
                  ResultSet rs = ps.executeQuery();
                  if (rs.next())
                       // valid
                       return true;
                     System.out.println("GET LOST FRED");
                  

                  }


            catch ( ClassNotFoundException cnfex ) {
                  System.err.println(
                  "Failed to load JDBC/ODBC driver." );
                  cnfex.printStackTrace();
                  System.exit( 1 );  // terminate program
                                                }
            catch ( SQLException sqlex ) {
                  System.err.println( "Unable to connect" );
                  sqlex.printStackTrace();
                  System.exit( 1 );  // terminate program
                  }

                  return false; //???????

      }


Thanks.
_EsamStart Free Trial
[+][-]03.17.2005 at 10:29PM PST, ID: 13572105

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.17.2005 at 10:44PM PST, ID: 13572162

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Java Programming Language
Tags: return, rmi, value
Sign Up Now!
Solution Provided By: durgaprasad_j
Participating Experts: 1
Solution Grade: A
 
 
[+][-]03.17.2005 at 10:44PM PST, ID: 13572165

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.17.2005 at 10:48PM PST, ID: 13572177

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.17.2005 at 10:53PM PST, ID: 13572193

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.17.2005 at 10:58PM PST, ID: 13572212

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.17.2005 at 11:11PM PST, ID: 13572239

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.17.2005 at 11:13PM PST, ID: 13572251

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.17.2005 at 11:15PM PST, ID: 13572256

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.17.2005 at 11:15PM PST, ID: 13572257

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.17.2005 at 11:19PM PST, ID: 13572273

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32