getUserInfo.java
上传用户:liangcc
上传日期:2019-05-24
资源大小:4412k
文件大小:1k
- package com.softeem.webmail.dao.receive;
- import java.sql.Connection;
- import java.sql.PreparedStatement;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import com.softeem.webmail.beans.receive.User;
- import com.softeem.webmail.dao.DBManager;
- public class getUserInfo extends DBManager {
-
- public static User getInfo(String username){
- User user=null;
- Connection conn=DBManager.getConnection();
- String sql="select * from user where username=?";
- try {
- PreparedStatement ps=conn.prepareStatement(sql);
- ps.setString(1, username);
- ResultSet rs=ps.executeQuery();
- while(rs.next()){
- user=new User();
- user.setUsername(rs.getString(1));
- user.setDearname(rs.getString(2));
- user.setPassword(rs.getString(3));
- }
- return user;
- } catch (SQLException e) {
- e.printStackTrace();
- }
- return null;
- }
- }