4 Replies Latest reply on Nov 3, 2003 8:33 AM by steadytommy

    Reply from Server: Your userid is null

    steadytommy Newbie

      Hi guy i am new to thsi and not sure what teh hell i am doing any help is welcome...
      In class public class StoreAccessDAOImpl implements StoreAccessDAO

      I am using this code to get the user id....

      public String loginUser(String username1, String password1) {
      // TODO Auto-generated method stub
      System.out.println("Entering StoreAccessDAOImpl loginUser ");
      Connection conn = null;
      //PreparedStatement ps = null;
      Statement ps = null;
      ResultSet rs = null;
      String userID = null;
      String queryString = null;
      String temp = null;
      int count = 0;
      try{
      count++;
      System.out.println("Entering StoreAccessDAOImpl loginUser try");
      conn = jdbcFactory.getConnection();
      //String queryString ="select userid from storeaccess where username = ? password = ?" ;
      ps = conn.createStatement();
      System.out.println("Entering StoreAccessDAOImpl loginUser after the createstement");

      rs = ps.executeQuery("SELECT USERID FROM STOREACCESS WHERE " +
      "(USERNAME=" + username1 + " AND PASSWORD=" + password1 +") ");

      temp = rs.getString("USERID");
      System.out.println("userId as we are going though " + temp);
      System.out.println("we have been though " + count);
      //ps = conn.prepareStatement(queryString);
      //ps.setString(1, username1);
      //ps.setString(1, password1);
      //rs = ps.executeQuery();
      boolean results = rs.next();
      if (results) {
      userID = rs.getString("USERID");
      System.out.println("userId is " + userID);
      }
      }
      catch (SQLException e){
      e.printStackTrace();
      System.out.println("inside StoreAccessDAOImpl loginUser " + e);
      }
      finally{
      try{
      rs.close();
      ps.close();
      conn.close();
      }
      catch(Exception e){
      }
      }
      System.out.println("inside StoreAccessDAOImpl loginUser " );
      return userID;
      }

      }


      ANd i am getting this trace ( section of it any way)...

      23:25:43,922 INFO [EJBDeployer] Deployed: file:/C:/jboss-3.2.2/server/all/deploy/MyStore.jar
      23:25:44,002 INFO [MainDeployer] Deployed package: file:/C:/jboss-3.2.2/server/all/deploy/MyStore.jar
      23:26:11,111 INFO [STDOUT] Entering StoreAccessBean loginUser
      23:26:11,111 INFO [STDOUT] Leaving StoreAccessBean loginUser
      23:26:11,121 INFO [STDOUT] Entering StoreAccessDAOImpl int
      23:26:11,131 INFO [STDOUT] leaving StoreAccessDAOImpl int
      23:26:11,131 INFO [STDOUT] Entering StoreAccessDAOImpl loginUser
      23:26:11,131 INFO [STDOUT] Entering StoreAccessDAOImpl loginUser try
      23:26:11,151 INFO [STDOUT] Entering StoreAccessDAOImpl loginUser after the createstement
      23:26:11,161 ERROR [STDERR] java.sql.SQLException: Table not found: STOREACCESS in statement [SELECT USERID FROM STOREACCESS WHERE (USERNAME=ANDY AND PASSWORD=PASSWD) ]
      23:26:11,161 ERROR [STDERR] at org.hsqldb.Trace.getError(Unknown Source)
      23:26:11,161 ERROR [STDERR] at org.hsqldb.jdbcResultSet.(Unknown Source)
      23:26:11,161 ERROR [STDERR

      and this output

      Request from client :
      Reply from Server: Your userid is null

      could some one please tell me what i am doing wrong.

      thanks