Examples of DBUtil


Examples of ch.qos.logback.core.db.dialect.DBUtil

      if (connection == null) {
        addWarn("Could not get a connection");
        return;
      }
      DatabaseMetaData meta = connection.getMetaData();
      DBUtil util = new DBUtil();
      util.setContext(getContext());
      supportsGetGeneratedKeys = util.supportsGetGeneratedKeys(meta);
      supportsBatchUpdates = util.supportsBatchUpdates(meta);
      dialectCode = DBUtil.discoverSQLDialect(meta);
      addInfo("Driver name="+meta.getDriverName());
      addInfo("Driver version="+meta.getDriverVersion());
      addInfo("supportsGetGeneratedKeys="+supportsGetGeneratedKeys);
     
View Full Code Here

Examples of ch.qos.logback.core.db.dialect.DBUtil

      if (connection == null) {
        addWarn("Could not get a connection");
        return;
      }
      DatabaseMetaData meta = connection.getMetaData();
      DBUtil util = new DBUtil();
      util.setContext(getContext());
      supportsGetGeneratedKeys = util.supportsGetGeneratedKeys(meta);
      supportsBatchUpdates = util.supportsBatchUpdates(meta);
      dialectCode = DBUtil.discoverSQLDialect(meta);
      System.out.println("Driver name="+meta.getDriverName());
      System.out.println("Driver version="+meta.getDriverVersion());
      System.out.println("supportsGetGeneratedKeys="+supportsGetGeneratedKeys);
     
View Full Code Here

Examples of ch.qos.logback.core.db.dialect.DBUtil

      if (connection == null) {
        addWarn("Could not get a connection");
        return;
      }
      DatabaseMetaData meta = connection.getMetaData();
      DBUtil util = new DBUtil();
      util.setContext(getContext());
      supportsGetGeneratedKeys = util.supportsGetGeneratedKeys(meta);
      supportsBatchUpdates = util.supportsBatchUpdates(meta);
      dialectCode = DBUtil.discoverSQLDialect(meta);
    } catch (SQLException se) {
      addWarn("Could not discover the dialect to use.", se);
    }
  }
View Full Code Here

Examples of ch.qos.logback.core.db.dialect.DBUtil

      if (connection == null) {
        addWarn("Could not get a connection");
        return;
      }
      DatabaseMetaData meta = connection.getMetaData();
      DBUtil util = new DBUtil();
      util.setContext(getContext());
      supportsGetGeneratedKeys = util.supportsGetGeneratedKeys(meta);
      supportsBatchUpdates = util.supportsBatchUpdates(meta);
      dialectCode = DBUtil.discoverSQLDialect(meta);
      System.out.println("Driver name="+meta.getDriverName());
      System.out.println("Driver version="+meta.getDriverVersion());
      System.out.println("supportsGetGeneratedKeys="+supportsGetGeneratedKeys);
     
View Full Code Here

Examples of ch.qos.logback.core.db.dialect.DBUtil

      if (connection == null) {
        addWarn("Could not get a connection");
        return;
      }
      DatabaseMetaData meta = connection.getMetaData();
      DBUtil util = new DBUtil();
      util.setContext(getContext());
      supportsGetGeneratedKeys = util.supportsGetGeneratedKeys(meta);
      supportsBatchUpdates = util.supportsBatchUpdates(meta);
      dialectCode = DBUtil.discoverSQLDialect(meta);
      addInfo("Driver name="+meta.getDriverName());
      addInfo("Driver version="+meta.getDriverVersion());
      addInfo("supportsGetGeneratedKeys="+supportsGetGeneratedKeys);
     
View Full Code Here

Examples of ch.qos.logback.core.db.dialect.DBUtil

      if (connection == null) {
        addWarn("Could not get a connection");
        return;
      }
      DatabaseMetaData meta = connection.getMetaData();
      DBUtil util = new DBUtil();
      util.setContext(getContext());
      supportsGetGeneratedKeys = util.supportsGetGeneratedKeys(meta);
      supportsBatchUpdates = util.supportsBatchUpdates(meta);
      dialectCode = DBUtil.discoverSQLDialect(meta);
      addInfo("Driver name="+meta.getDriverName());
      addInfo("Driver version="+meta.getDriverVersion());
      addInfo("supportsGetGeneratedKeys="+supportsGetGeneratedKeys);
     
View Full Code Here

Examples of ch.qos.logback.core.db.dialect.DBUtil

      if (connection == null) {
        addWarn("Could not get a connection");
        return;
      }
      DatabaseMetaData meta = connection.getMetaData();
      DBUtil util = new DBUtil();
      util.setContext(getContext());
      supportsGetGeneratedKeys = util.supportsGetGeneratedKeys(meta);
      supportsBatchUpdates = util.supportsBatchUpdates(meta);
      dialectCode = DBUtil.discoverSQLDialect(meta);
      addInfo("Driver name="+meta.getDriverName());
      addInfo("Driver version="+meta.getDriverVersion());
      addInfo("supportsGetGeneratedKeys="+supportsGetGeneratedKeys);
     
View Full Code Here

Examples of com.hdfs.util.DBUtil

  }

  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());
      pstmt.setString(2, optime);
      pstmt.setString(3, action);
      pstmt.setString(4, filename);
      pstmt.setString(5, pathname);
      if (pstmt.executeUpdate() > 0)
        return true;
    } catch (SQLException e) {
      e.printStackTrace();
    } finally {
      util.closeConnection(conn);
    }
    return false;
  }
View Full Code Here

Examples of 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);
    }
    return u;
  }
View Full Code Here

Examples of com.hdfs.util.DBUtil

    return u;
  }

  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) {
        return true;
      } else {
        return false;
      }
    } catch (SQLException e) {
      e.printStackTrace();
    } finally {
      util.closeConnection(conn);
    }
    return false;
  }
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.