Package com.hdfs.util

Examples of com.hdfs.util.DBUtil.openConnection()


  ArrayList<Log> logList = new ArrayList<Log>();

  public ArrayList<Log> read(String username) {
    String sql = "SELECT username, optime, action, filename, pathname FROM log WHERE username = ? order by optime desc";
    DBUtil util = new DBUtil();
    Connection conn = util.openConnection();
    try {
      PreparedStatement pstmt = conn.prepareStatement(sql);
      pstmt.setString(1, username);
      ResultSet rs = pstmt.executeQuery();
      while (rs.next()) {
View Full Code Here


  public boolean write(String username, String action, String filename,
      String pathname) {
    String sql = "INSERT INTO log (username, optime, action, filename, pathname) VALUES(?, ?, ?, ?, ?)";
    DBUtil util = new DBUtil();
    Connection conn = util.openConnection();
    try {
      PreparedStatement pstmt = conn.prepareStatement(sql);
      pstmt.setString(1, username);
      String optime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
          .format(new Date());
View Full Code Here

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();
View Full Code Here

  }

  public boolean register(String username, String password) {
    String sql = "INSERT INTO user (username, password) VALUES(?, ?)";
    DBUtil util = new DBUtil();
    Connection conn = util.openConnection();
    try {
      PreparedStatement pstmt = conn.prepareStatement(sql);
      pstmt.setString(1, username);
      pstmt.setString(2, password);
      if (pstmt.executeUpdate() > 0) {
View Full Code Here

  }
  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()) {
View Full Code Here

public class PictureDaoImpl implements PictureDao {
  public boolean insert(String username, String pathname) {
    String sql = "INSERT INTO picture (username, pathname) VALUES(?, ?)";
    DBUtil util = new DBUtil();
    Connection conn = util.openConnection();
    try {
      PreparedStatement pstmt = conn.prepareStatement(sql);
      pstmt.setString(1, username);
      pstmt.setString(2, pathname);
      if (pstmt.executeUpdate() > 0) {
View Full Code Here

  public ArrayList<String> get(String username) {
    ArrayList<String> paths = new ArrayList<String>();
    String sql = "SELECT pathname FROM picture WHERE username=?";
    DBUtil util = new DBUtil();
    Connection conn = util.openConnection();
    try {
      PreparedStatement pstmt = conn.prepareStatement(sql);
      pstmt.setString(1, username);
      ResultSet rs = pstmt.executeQuery();
      while (rs.next()) {
View Full Code Here

  }

  public boolean delete(String pathname) {
    String sql = "DELETE FROM picture WHERE pathname=?";
    DBUtil util = new DBUtil();
    Connection conn = util.openConnection();
    try {
      PreparedStatement pstmt = conn.prepareStatement(sql);
      pstmt.setString(1, pathname);
      if (pstmt.executeUpdate() > 0) {
        return true;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.