Package com.hdfs.pojo

Examples of com.hdfs.pojo.User


import com.hdfs.pojo.User;
import com.hdfs.util.DBUtil;

public class UserDaoImpl implements UserDao {
  public User login(String username, String password) {
    User u = null;
    String sql = "SELECT * FROM user WHERE username=? and password=? ";
    DBUtil util = new DBUtil();
    Connection conn = util.openConnection();
    try {
      PreparedStatement pstmt = conn.prepareStatement(sql);
      pstmt.setString(1, username);
      pstmt.setString(2, password);
      ResultSet rs = pstmt.executeQuery();
      if (rs.next()) {
        u = new User();
        u.setUsername(rs.getString(1));
        u.setPassword(rs.getString(2));
      }
    } catch (SQLException e) {
      e.printStackTrace();
    } finally {
      util.closeConnection(conn);
View Full Code Here


      util.closeConnection(conn);
    }
    return false;
  }
  public User getinfo(String username) {
    User u = null;
    String sql = "SELECT * FROM user WHERE username=?";
    DBUtil util = new DBUtil();
    Connection conn = util.openConnection();
    try {
      PreparedStatement pstmt = conn.prepareStatement(sql);
      pstmt.setString(1, username);
      ResultSet rs = pstmt.executeQuery();
      if (rs.next()) {
        u = new User();
        u.setUsername(rs.getString(1));
        u.setPassword(rs.getString(2));
      }
    } catch (SQLException e) {
      e.printStackTrace();
    } finally {
      util.closeConnection(conn);
View Full Code Here

TOP

Related Classes of com.hdfs.pojo.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.